Skip to content

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

@nyarly

Description

@nyarly

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contentThis issue or pull request belongs to the Docs Content teamgithub_actionsPull requests that update GitHub Actions code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions