clasp-action icon indicating copy to clipboard operation
clasp-action copied to clipboard

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

Open isaiahdaviscom opened this issue 2 years ago • 2 comments

Run daikikatsuragawa/[email protected]
  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.

isaiahdaviscom avatar Nov 16 '22 08:11 isaiahdaviscom

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

alex-galey avatar Dec 29 '22 15:12 alex-galey

@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.

maariavld avatar Aug 22 '23 10:08 maariavld