daikikatsuragawa / clasp-action

This action uses clasp to push or deploy to Google Apps Script.
https://github.com/marketplace/actions/clasp-action
MIT License
31 stars 14 forks source link

ENOENT: no such file or directory, open '/appsscript.json' #9

Open isaiahdaviscom opened 1 year ago

isaiahdaviscom commented 1 year ago
Run daikikatsuragawa/clasp-action@v1.0.1
  with:
    accessToken: ***
    idToken: ***
    refreshToken: ***
    clientId: ***
    clientSecret: ***
    scriptId: ***
    rootDir: ***
    command: push
##[debug]Evaluating: inputs.accessToken
##[debug]Evaluating Index:
##[debug]..Evaluating inputs:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'accessToken'
##[debug]=> '***'

I am passing GitHub Secrets as arguments for all the required fields of this Action.

The Action runs on changes to the main branch.

The main branch structure has the Action main.yml file under /.github/workflows.

When the main.yml file is executed the following error occurs at runtime:

ENOENT: no such file or directory, open '/appsscript.json'

The /appscript.json file is located at the root directory.

I attempted to replace the GitHub Secret for the object rootDir to a string literal, but with no resolve.

alex-galey commented 1 year ago

This is how I achieved autodeploying to GAS :

Github workflow - deploy.yml

name: Deploy

on:
  push:
    branches: [ main ]

jobs:
  deploy:
    if: ${{ github.actor != 'dependabot' }}
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2

    - name: Use Node 16
      uses: actions/setup-node@v2
      with:
        node-version: 16.x
        cache: 'npm'

    - name: Install npm packages
      run: npm install

    - name: Create clasp.json
      env:
        SCRIPT_ID: ${{ secrets.SCRIPT_ID }}
      run: echo '{"scriptId":"'$SCRIPT_ID'","rootDir":"dist"}' > .clasp.json

    - name: Create folder structure
      run: mkdir -p /home/runner

    - name: Create clasprc.json
      env:
        CLASPRC: ${{ secrets.CLASPRC }}
      run: echo "$CLASPRC" > /home/runner/.clasprc.json

    - name: Deploy
      run: npm run deploy

Scripts in package.json :

  "scripts": {
    "build": "webpack",
    "upload": "npx clasp push -f",
    "deploy": "npm run build && npm run upload",
  }

With clasp has a dev dependency

maariavld commented 1 year ago

@isaiahdaviscom maybe you fixed it by now, but there is a typo in your file name. I also encountered the same issue, the correct file name is appsscript.json with a double s as the error says.