Skip to content

Using Github Action environment variables in shell script #27027

Discussion options

You must be logged in to vote

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/migrate.sh
  env:
    ENVIRONMENT_VARIABLE_NAME: ${{ secrets.ENVIRONMENT_VARIABLE_NAME }}

And then use that environment variable in your script.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants