From e0aadd55e788db8eae85b92cf95ffa5a7d6564a6 Mon Sep 17 00:00:00 2001 From: Phred Date: Fri, 19 Jun 2026 17:42:13 -0500 Subject: [PATCH 1/2] feat: added `refName` and `refType` to context source: https://docs.github.com/en/actions/reference/workflows-and-actions/variables\#default-environment-variables --- packages/github/src/context.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/github/src/context.ts b/packages/github/src/context.ts index 60554fd322..0840b13254 100644 --- a/packages/github/src/context.ts +++ b/packages/github/src/context.ts @@ -12,6 +12,8 @@ export class Context { eventName: string sha: string ref: string + refName: string + refType: string workflow: string action: string actor: string @@ -41,6 +43,8 @@ export class Context { 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 this.workflow = process.env.GITHUB_WORKFLOW as string this.action = process.env.GITHUB_ACTION as string this.actor = process.env.GITHUB_ACTOR as string From a3590c036004e90f95731c9bb010fd5af1c0641b Mon Sep 17 00:00:00 2001 From: Phred Date: Fri, 19 Jun 2026 18:27:47 -0500 Subject: [PATCH 2/2] added missing unit tests --- packages/github/__tests__/lib.test.ts | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/packages/github/__tests__/lib.test.ts b/packages/github/__tests__/lib.test.ts index e77e79c627..12b283d23f 100644 --- a/packages/github/__tests__/lib.test.ts +++ b/packages/github/__tests__/lib.test.ts @@ -79,4 +79,32 @@ describe('@actions/context', () => { repo: 'test' }) }) + + describe('refs', () => { + it.each([ + 'refs/heads/main', + 'refs/heads/feature-branch', + 'refs/pull/42/merge', + 'refs/tags/v2.0.4' + ])(`should set context.ref: %s`, ref => { + process.env.GITHUB_REF = ref + + expect(new Context()).toHaveProperty(`ref`, ref) + }) + + it.each([`meh-${Date.now()}`, 'catpants', 'v1.2.3'])( + 'should set context.refName: %s', + refName => { + process.env.GITHUB_REF_NAME = refName + + expect(new Context()).toHaveProperty('refName', refName) + } + ) + + it.each(['branch', 'tag'])('should set context.refType: %s', refType => { + process.env.GITHUB_REF_TYPE = refType + + expect(new Context()).toHaveProperty('refType', refType) + }) + }) })