From 7f1e68471043c0fd2d3b8bffd44fc10a45e9566d Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sat, 21 Mar 2026 04:34:15 +0000
Subject: [PATCH 1/2] Initial plan


From 4c60837f13c1bdf1b93665011155b4abeb3ec2b6 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sat, 21 Mar 2026 04:41:29 +0000
Subject: [PATCH 2/2] fix: add github.event_name to JS allowed expressions list

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/9d816964-495d-4fb6-a840-6ab9c6b3d142
---
 actions/setup/js/runtime_import.cjs      | 2 ++
 actions/setup/js/runtime_import.test.cjs | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/actions/setup/js/runtime_import.cjs b/actions/setup/js/runtime_import.cjs
index 3c990dae7c2..a210df75de9 100644
--- a/actions/setup/js/runtime_import.cjs
+++ b/actions/setup/js/runtime_import.cjs
@@ -98,6 +98,7 @@ const ALLOWED_EXPRESSIONS = [
   "github.event.pull_request.head.sha",
   "github.event.pull_request.base.sha",
   "github.actor",
+  "github.event_name",
   "github.job",
   "github.owner",
   "github.repository",
@@ -291,6 +292,7 @@ function evaluateExpression(expr) {
       const evalContext = {
         github: {
           actor: context.actor,
+          event_name: context.eventName,
           job: context.job,
           owner: context.repo.owner,
           repository: `${context.repo.owner}/${context.repo.repo}`,
diff --git a/actions/setup/js/runtime_import.test.cjs b/actions/setup/js/runtime_import.test.cjs
index 32c912ceedf..0997d8372cb 100644
--- a/actions/setup/js/runtime_import.test.cjs
+++ b/actions/setup/js/runtime_import.test.cjs
@@ -87,6 +87,7 @@ describe("runtime_import", () => {
         expect(isSafeExpression("github.actor")).toBe(!0);
         expect(isSafeExpression("github.repository")).toBe(!0);
         expect(isSafeExpression("github.event.issue.number")).toBe(!0);
+        expect(isSafeExpression("github.event_name")).toBe(!0);
       });
       it("should allow dynamic patterns", () => {
         expect(isSafeExpression("needs.job-id.outputs.result")).toBe(!0);
@@ -256,6 +257,7 @@ describe("runtime_import", () => {
         // Mock the global context object
         global.context = {
           actor: "testuser",
+          eventName: "issues",
           job: "test-job",
           repo: { owner: "testorg", repo: "testrepo" },
           runId: 12345,
@@ -270,6 +272,7 @@ describe("runtime_import", () => {
       it("should evaluate basic expressions", () => {
         expect(evaluateExpression("github.actor")).toBe("testuser");
         expect(evaluateExpression("github.repository")).toBe("testorg/testrepo");
+        expect(evaluateExpression("github.event_name")).toBe("issues");
       });
       it("should evaluate OR with literal fallback when left is undefined", () => {
         expect(evaluateExpression("inputs.missing || 'default'")).toBe("default");
@@ -702,6 +705,7 @@ describe("runtime_import", () => {
       beforeEach(() => {
         global.context = {
           actor: "testuser",
+          eventName: "issues",
           job: "test-job",
           repo: { owner: "testorg", repo: "testrepo" },
           runId: 12345,
@@ -727,6 +731,7 @@ describe("runtime_import", () => {
           expect(isSafeExpression("github.repository")).toBe(true);
           expect(isSafeExpression("github.event.issue.number")).toBe(true);
           expect(isSafeExpression("github.event.pull_request.title")).toBe(true);
+          expect(isSafeExpression("github.event_name")).toBe(true);
         });
 
         it("should allow dynamic patterns", () => {
@@ -755,6 +760,7 @@ describe("runtime_import", () => {
           expect(evaluateExpression("github.actor")).toBe("testuser");
           expect(evaluateExpression("github.repository")).toBe("testorg/testrepo");
           expect(evaluateExpression("github.run_id")).toBe("12345");
+          expect(evaluateExpression("github.event_name")).toBe("issues");
         });
 
         it("should evaluate nested event properties", () => {
