From 5637b136131bc46f1b025cf31b7a9215978de8cb Mon Sep 17 00:00:00 2001 From: James Wiesebron Date: Wed, 8 Jul 2026 20:31:23 -0700 Subject: [PATCH] get-changed-files: fix core.warn crash on multi-PR push events The github-script core API method is core.warning; core.warn does not exist. The call sits on the path taken only when a pushed commit is associated with more than one open PR (stacked PRs), so instead of warning and proceeding with the first PR, the action crashed with 'core.warn is not a function'. --- .changeset/get-changed-files-warning.md | 5 +++++ actions/get-changed-files/get-changed-files.test.ts | 4 ++-- actions/get-changed-files/index.ts | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .changeset/get-changed-files-warning.md diff --git a/.changeset/get-changed-files-warning.md b/.changeset/get-changed-files-warning.md new file mode 100644 index 00000000..2b17d309 --- /dev/null +++ b/.changeset/get-changed-files-warning.md @@ -0,0 +1,5 @@ +--- +"get-changed-files": patch +--- + +Fix a crash (`core.warn is not a function`) on push events when the pushed commit is associated with more than one open PR, as happens with stacked PRs. The github-script `core` API method is `core.warning`, not `core.warn`. diff --git a/actions/get-changed-files/get-changed-files.test.ts b/actions/get-changed-files/get-changed-files.test.ts index 4f9329c2..73feeadc 100644 --- a/actions/get-changed-files/get-changed-files.test.ts +++ b/actions/get-changed-files/get-changed-files.test.ts @@ -8,7 +8,7 @@ type PullRequestSummary = { }; const makeCore = () => ({ - warn: vi.fn(), + warning: vi.fn(), info: vi.fn(), setFailed: vi.fn(), setOutput: vi.fn(), @@ -161,7 +161,7 @@ describe("getChangedFiles", () => { prLookupArgs: github.rest.repos.listPullRequestsAssociatedWithCommit.mock .calls[0]?.[0], - warnCalls: core.warn.mock.calls.length, + warnCalls: core.warning.mock.calls.length, compareArgs: github.rest.repos.compareCommits.mock.calls[0]?.[0], }).toEqual({ prLookupArgs: { diff --git a/actions/get-changed-files/index.ts b/actions/get-changed-files/index.ts index 26212650..d199c066 100644 --- a/actions/get-changed-files/index.ts +++ b/actions/get-changed-files/index.ts @@ -54,7 +54,7 @@ type ContextLike = { }; type CoreLike = { - warn: (message: string) => void; + warning: (message: string) => void; info: (message: string) => void; setFailed: (message: string) => void; setOutput: (name: string, value: string) => void; @@ -113,7 +113,7 @@ const getBaseAndHead = async ( `Could not determine base ref for '${context.eventName}' event.`, ); } - core.warn( + core.warning( `Found ${pullRequests.length} PRs with the pushed commit (${afterSha}). ` + `Proceeding on a hunch with the first one (#${first.number} - ${first.title})`, );