Using Github Action environment variables in shell script #27027
-
|
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 Within migrate.sh Git log error |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
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: And then use that environment variable in your script. |
Beta Was this translation helpful? Give feedback.
-
|
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! |
Beta Was this translation helpful? Give feedback.
-
|
The below works for me let more here git actions lab |
Beta Was this translation helpful? Give feedback.
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:
And then use that environment variable in your script.