Skip to content

Setup environment variable with export command #26013

Discussion options

You must be logged in to vote

The problem is that each run step gets its own shell instance, so the export doesn’t carry over. To set an environment variable for the rest of the job you need to use the set-env workflow command:

- run: echo "::set-env name=CR_PAT::GITHUB_CONTAINER_REGISTRY_PAT"

After that either of the references should work. Or, if you need CR_PAT only in that one step you could use an env property for the step:

- run: echo ${CR_PAT}
  env:
    CR_PAT: GITHUB_CONTAINER_REGISTRY_PAT

Replies: 1 comment

Comment options

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