Skip to content

Are github.head_ref and github.base_ref null when not a pull request? #13810

@dlech

Description

@dlech

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/actions/learn-github-actions/contexts#github-context

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

The base_ref or target branch of the pull request in a workflow run. This property is only available when the event that triggers a workflow run is either pull_request or pull_request_target.

Stating that the property is not available is ambiguous. If I use ${{ github.base_ref }} in an action, does it return null, does it cause an error, or something else if the trigger is not a pull request?

Additional information

The same clarification is needed for github.base_ref.

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 teamwaiting for reviewIssue/PR is waiting for a writer's review

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions