Can workflow-level 'env:' values reference other context variables like 'github.ref'?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Workflow-level env: is evaluated at parse time before contexts exist — use job or step level env: for context-dependent variable values.
Full explanation below image
Full Explanation
Workflow-level 'env:' blocks cannot use expression contexts like '${{ github.ref }}' because the workflow env: is parsed before the runtime context is available. Attempting to use '${{ github.ref }}' in a workflow-level env: value will result in a literal string, not the resolved value. The github, env, secrets, and other contexts are only available in step-level and job-level expressions during execution. For dynamic environment variables based on context values, define them at the job or step level: 'env: MY_BRANCH: ${{ github.ref }}' inside a job or step.