Skip to content

GITHUB_REF and GITHUB_REF_NAME examples in Actions docs unclear #15319

@oofnikj

Description

@oofnikj

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables

What part(s) of the article would you like to see updated?

GITHUB_REF and GITHUB_REF_NAME show example values of refs/heads/feature-branch-1 and feature-branch-1 respectively. However this is inconsistent with the values populated in the case of a PR-triggered workflow.

Given the description and example, one would expect to see the branch that triggered the workflow when running a PR-triggered workflow. Instead these variables are populated by values like refs/pull/26/merge and 26/merge respectively. The variable that contains the desired data in this case is actually GITHUB_HEAD_REF.

The documentation should be updated to more accurately describe the content of GitHub Actions predefined variables.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionsThis issue or pull request should be reviewed by the docs actions teamcontentThis issue or pull request belongs to the Docs Content team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions