How to access env variable in "contains" arguments #25968
-
Is there a way to access env variables inside
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
That should work using the |
Beta Was this translation helpful? Give feedback.
-
Here’s the error I’m getting
|
Beta Was this translation helpful? Give feedback.
-
This should work, you have to use single quotes for the string - see https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#literals:
|
Beta Was this translation helpful? Give feedback.
-
I get the following error: |
Beta Was this translation helpful? Give feedback.
-
According to the description from the docs about the env context:
You can’t use the env context in a job’s if conditional.
|
Beta Was this translation helpful? Give feedback.
-
For anyone else stumbling on this that was as confused as I was, and going round in circle’s, the key part of “in a step’s if conditional” is the word “step”. So you can use env variables in a “step’s if conditional” but not the higher level “jobs if conditional” (to skip the whole action for example). Wasted far too much time on that!! |
Beta Was this translation helpful? Give feedback.
@ma-sadeghi,
According to the description from the docs about the env context:
You can’t use the env context in a job’s if conditional.
You can directly use the github context in the job’s if conditional.