docs icon indicating copy to clipboard operation
docs copied to clipboard

Clarify Environment Variable Context Differences Between Self-Hosted and GitHub-Hosted Runners

Open nyarly opened this issue 3 months ago • 6 comments

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.

nyarly avatar Sep 16 '25 22:09 nyarly

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.

welcome[bot] avatar Sep 16 '25 22:09 welcome[bot]

IS THIS THE SAME DIRECT ORDER LOL

Grax23 avatar Sep 17 '25 12:09 Grax23

@nyarly Thanks for opening an issue! I'll get this triaged for review.

Sharra-writes avatar Sep 19 '25 04:09 Sharra-writes

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.

github-actions[bot] avatar Nov 18 '25 16:11 github-actions[bot]

It ain't SAFE FOR THE BLACK OR THE WHITE CUZ

Grax23 avatar Nov 18 '25 18:11 Grax23

Hi

Grax23 avatar Dec 11 '25 18:12 Grax23