Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/get-changed-files-warning.md
Original file line number Diff line number Diff line change
@@ -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`.
4 changes: 2 additions & 2 deletions actions/get-changed-files/get-changed-files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type PullRequestSummary = {
};

const makeCore = () => ({
warn: vi.fn(),
warning: vi.fn(),
info: vi.fn(),
setFailed: vi.fn(),
setOutput: vi.fn(),
Expand Down Expand Up @@ -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: {
Expand Down
4 changes: 2 additions & 2 deletions actions/get-changed-files/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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})`,
);
Expand Down
Loading