Reputation: 279
My understanding is that GitHub has environment scope secret and repository level secret. To refer to a repository level secret, you would do the following:
${{ secrets.SOME_TOKEN }}
I am trying to refer to an environment scoped secret, what is the syntax to refer to it, something like this?
${{ a_dev_environment.secrets.SOME_TOKEN }}
Or what is the precedence of the environment scope vs repository scope secret?
Upvotes: 2
Views: 3335
Reputation: 40553
When you want to use secret in the workflow you need to map it
To provide an action with a secret as an input or environment variable, you can use the secrets context to access secrets you've created in your repository. For more information, see "Context and expression syntax for GitHub Actions" and "Workflow syntax for GitHub Actions."
and
Organization and repository secrets are read when a workflow run is queued, and environment secrets are read when a job referencing the environment starts.
As this all secrets are mapped to secret
scope. So there is no a_dev_environment.secrets.SOME_TOKEN
syntax like this. And if you have the same name on different level - the last wins.
Upvotes: 3