Using Github Action environment variables in shell script

Currently I’m running into issues trying to get ${{ secrets.ENVIRONMENT_VARIABLE_NAME }} work within a bash script file. Does anyone know if using ${{ <context> }} is allowed in a bash script file? I can’t find any information on this in the Github Actions documentation

Step sample

- name: Run migrations
  run: sh ./github/scripts/


echo 'HELLO_WORLD='${{ secrets.HELLO_WORLD }} >> .env // Code line 1

Git log error

.github/scripts/ 1: .github/scripts/ Bad substitution  
1 Like

That won’t work, because “${{ <context> }}” and the “secrets” variable are GitHub Actions constructs that Bash doesn’t understand. You’ll have to pass the secret to your step as an environment variable:

- name: Run migrations
  run: sh ./github/scripts/

And then use that environment variable in your script.


I can see this solution being a great work around for those only need to pass in a couple of environment variables into their bash script file. I’ll mark this as the solution since this may benefit others in the future. Thanks!

The below works for me

bash -eux  .githib/scripts/ 

let more here git actions lab