Action showing permission denied

I had many environmental variables so I used to gpg to encrypt those variables in a file.

I then made a script to decrypt that file and to store it the backend folder of my project during the run of the action

All this are to happen in the github action (see below the yml file)

That script of mine looks something like this:


gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPTER_PASSPHRASE" \
--output ./backend/.env ./.github/secrets/backend.env.gpg

My script is running well when I am executing this command in the project root


But it fails during the github action

My backend-deploy.yml file is like this:

name: Backend Deploy

      - master
      - 'backend/**'

    runs-on: ubuntu-latest
      - uses: actions/checkout@v2
      - shell: bash
        run: >
# fails at this point
      - run: |
          cat backend/.env
          ls -a
          ls backend/
      - run: >
          ls -a
          ls -a backend/
          echo "Deployed to"

It is giving me this error:

How can I fix this ? Please help

That most likely means that your ./.github/scripts/ script doesn’t have the “execute” filesystem permission set. I assume you’re developing on Windows locally, which doesn’t have that kind of permission system.

You can tell git to add the permission anyway with this command:

git update-index --chmod=+x ./.github/scripts/

update-index is similar to add in that it adds the change to the index, so you’ll have to commit and push as usual.

1 Like

Thanks a lot @airtower-luna
This solved it

1 Like