Clarify Environment Variable Context Differences Between Self-Hosted and GitHub-Hosted Runners
Code of Conduct
- [x] 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_ENVfor 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.
Thanks for opening this issue. A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.
IS THIS THE SAME DIRECT ORDER LOL
@nyarly Thanks for opening an issue! I'll get this triaged for review.
A stale label has been added to this issue, because it has been open for 30 days with no activity. If you think this issue should remain open, please add a new comment.
It ain't SAFE FOR THE BLACK OR THE WHITE CUZ
Hi