From cce6fe0257f6ebbcc2826d2f07a92d45f46258d9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Feb 2026 03:27:54 +0000 Subject: [PATCH 1/2] Initial plan From 991bf3d492bb8866893417e83a36493ff74e1d1b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Feb 2026 03:34:44 +0000 Subject: [PATCH 2/2] Fix: Remove head_commit.id from numeric validation (Git SHA not numeric) Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .../setup/js/validate_context_variables.cjs | 2 -- .../js/validate_context_variables.test.cjs | 22 +++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/actions/setup/js/validate_context_variables.cjs b/actions/setup/js/validate_context_variables.cjs index cdf3ad2e7af..6c4f5a0550d 100644 --- a/actions/setup/js/validate_context_variables.cjs +++ b/actions/setup/js/validate_context_variables.cjs @@ -21,7 +21,6 @@ * - github.event.comment.id * - github.event.deployment.id * - github.event.deployment_status.id - * - github.event.head_commit.id * - github.event.installation.id * - github.event.workflow_job.run_id * - github.event.label.id @@ -61,7 +60,6 @@ const NUMERIC_CONTEXT_PATHS = [ { path: ["payload", "comment", "id"], name: "github.event.comment.id" }, { path: ["payload", "deployment", "id"], name: "github.event.deployment.id" }, { path: ["payload", "deployment_status", "id"], name: "github.event.deployment_status.id" }, - { path: ["payload", "head_commit", "id"], name: "github.event.head_commit.id" }, { path: ["payload", "installation", "id"], name: "github.event.installation.id" }, { path: ["payload", "workflow_job", "run_id"], name: "github.event.workflow_job.run_id" }, { path: ["payload", "label", "id"], name: "github.event.label.id" }, diff --git a/actions/setup/js/validate_context_variables.test.cjs b/actions/setup/js/validate_context_variables.test.cjs index 8dd48c8e7ba..c0d351c5282 100644 --- a/actions/setup/js/validate_context_variables.test.cjs +++ b/actions/setup/js/validate_context_variables.test.cjs @@ -225,8 +225,8 @@ describe("NUMERIC_CONTEXT_PATHS", () => { }); }); - it("should have 31 context paths", () => { - expect(NUMERIC_CONTEXT_PATHS.length).toBe(31); + it("should have 30 context paths", () => { + expect(NUMERIC_CONTEXT_PATHS.length).toBe(30); }); it("should not include duplicate names", () => { @@ -234,6 +234,11 @@ describe("NUMERIC_CONTEXT_PATHS", () => { const uniqueNames = [...new Set(names)]; expect(uniqueNames.length).toBe(NUMERIC_CONTEXT_PATHS.length); }); + + it("should not include github.event.head_commit.id (Git SHA, not numeric)", () => { + const found = NUMERIC_CONTEXT_PATHS.find(p => p.name === "github.event.head_commit.id"); + expect(found).toBeUndefined(); + }); }); describe("main", () => { @@ -298,4 +303,17 @@ describe("main", () => { expect(mockCore.setFailed).not.toHaveBeenCalled(); }); + + it("should not validate github.event.head_commit.id (Git SHA)", async () => { + // Add a Git commit SHA to the context + mockContext.payload.head_commit = { + id: "046ee07d682351acd49209ca43ba340931001c1a", + }; + + await main(); + + // Should pass because head_commit.id is not validated as numeric + expect(mockCore.setFailed).not.toHaveBeenCalled(); + expect(mockCore.info).toHaveBeenCalledWith(expect.stringContaining("✅ All context variables validated successfully")); + }); });