-
Notifications
You must be signed in to change notification settings - Fork 63.6k
Description
Code of Conduct
- I have read and agree to the GitHub Docs project's Code of Conduct
What article on docs.github.com is affected?
(Copilot helped me produce this issue based on a gap in the docs it helped me find.)
The documentation for GitHub Actions environment variables does not make it clear that default runner variables such as RUNNER_TEMP
are available as shell variables ($RUNNER_TEMP
) on self-hosted runners, but not automatically as workflow context variables (${{ env.RUNNER_TEMP }}
).
On GitHub-hosted runners, these variables appear to be available in both contexts by default, but on self-hosted runners, workflow users must explicitly export them to $GITHUB_ENV
to use them in workflow expressions. This difference can cause confusion and workflow failures when referencing variables as ${{ env.RUNNER_TEMP }}
.
Suggested improvements:
- Clearly document that on self-hosted runners, default runner environment variables are only available in the shell context and must be exported to
$GITHUB_ENV
for use in workflow expressions. - Provide an example of how to export shell variables to workflow context for self-hosted runners.
Example workaround:
- name: Export RUNNER_TEMP to workflow env
run: echo "RUNNER_TEMP=$RUNNER_TEMP" >> $GITHUB_ENV
This clarification would save users troubleshooting time and prevent unexpected workflow errors.
What part(s) of the article would you like to see updated?
As above
Additional information
According to Copilot, this would affect every user developing Github Actions for self-hosted runners.