env.GITHUB_WORKSPACE not defined at job.env context, Does it make sense? #35739
-
I was trying to define an environment variable global to a job using
My workflow looks like this, I define an environment at
The alternative is to define the environment variable on each step that uses it, this is verbose if you have a bunch of steps that use that environment variable.
So to avoid repeating the definition of the environment variable on each step (that does not make any sense), I have added a step that adds the environment variable to GITHUB_ENV. It is a workaround IMHO, a little forced. It is clear to define that environment variable in the
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Consider replacing See docs https://docs.github.com/en/actions/learn-github-actions/contexts#github-context.
|
Beta Was this translation helpful? Give feedback.
Consider replacing
env.GITHUB_WORKSPACE
withgithub.workspace
, then you are no longer using the not allowed context.See docs https://docs.github.com/en/actions/learn-github-actions/contexts#github-context.
GITHUB_WORKSPACE
is automatically created from thegithub
context, but only for steps and I think you can never access it from theenv
context.