Question about expression context parsing

This might be the dumbest question ever…

What contexts in a workflow is it possible to use MYVAR and when it is required to use {{ env.MYVAR }} ?

I can’t find any documentation on this.

also as a followup, is it possible to create a workflow level environment variable using bash to evaluate something dynamically?

$MYVAR is Bash (and generally Unix shell) syntax. ${{ env.MYVAR }} is Github actions syntax. So you can use the former wherever you have a shell, which is in the run part of steps (unless you set another interpreter, or run on Windows).

And for creating environment variables, see Setting an environment variable. :wink: In short, you can do something like


which writes the variable to a special file, and the Actions runner makes sure it’s available in subsequent steps. And you can of course build that definition dynamically.


Thanks! I wasn’t sure if run was the only step that supports shell syntax.

For the second question, I’m talking about trying to set a workflow level env variable using bash.

There’s no equivalent at the workflow level. The syntax I mentioned above works at the job level, for all steps after the one setting the variable.

If you want to transfer data between jobs look at outputs, or possibly artifacts.


Thanks, too bad. I guess I’ll have to create a feature request for that!

1 Like