Skip to content

feat(@actions/github): added refName and refType to context#2440

Open
fearphage wants to merge 2 commits into
actions:mainfrom
fearphage:add-missing-context
Open

feat(@actions/github): added refName and refType to context#2440
fearphage wants to merge 2 commits into
actions:mainfrom
fearphage:add-missing-context

Conversation

@fearphage

Copy link
Copy Markdown

Summary

  • Added refName exposing GITHUB_REF_NAME environment variable
  • Added refType exposing GITHUB_REF_TYPE environment variable

Background

Both of the environment variables are documented in the default environment variables section:

Variable Description
GITHUB_REF_NAME The short ref name of the branch or tag that triggered the workflow run. This value matches the branch or tag name shown on GitHub. For example, feature-branch-1.

For pull requests that were not merged, the format is <pr_number>/merge.
GITHUB_REF_TYPE The type of ref that triggered the workflow run. Valid values are branch or tag.

Source: https://docs.github.com/en/actions/reference/workflows-and-actions/variables#default-environment-variables

Note

I didn't see any unit tests related to these data values. Let me know if I missed anything.

@fearphage fearphage requested a review from a team as a code owner June 19, 2026 22:54
Copilot AI review requested due to automatic review settings June 19, 2026 22:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the @actions/github runtime context by exposing two additional default GitHub Actions environment variables (GITHUB_REF_NAME and GITHUB_REF_TYPE) as context.refName and context.refType, making ref metadata easier to consume without manual env parsing.

Changes:

  • Added refName to Context, populated from process.env.GITHUB_REF_NAME.
  • Added refType to Context, populated from process.env.GITHUB_REF_TYPE.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 43 to +47
this.eventName = process.env.GITHUB_EVENT_NAME as string
this.sha = process.env.GITHUB_SHA as string
this.ref = process.env.GITHUB_REF as string
this.refName = process.env.GITHUB_REF_NAME as string
this.refType = process.env.GITHUB_REF_TYPE as string
@pNm193

pNm193 commented Jun 21, 2026

Copy link
Copy Markdown

Needs 404 error page fixed before approval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants