Skip to content

Commit 25488a3

Browse files
chore(bundler-plugin-core): bump @actions/core and @actions/github
- @actions/core ^3.0.0, @actions/github ^9.0.0; engines.node >=20 - Adjust GitHubActions tests: ESM context export is read-only - Changeset documents upstream RELEASES.md impact (ESM-only, Node 20, Octokit) Made-with: Cursor
1 parent c1737d0 commit 25488a3

File tree

4 files changed

+338
-542
lines changed

4 files changed

+338
-542
lines changed

.changeset/bump-actions-toolkit.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
"@codecov/bundler-plugin-core": minor
3+
---
4+
5+
Bump `@actions/core` to ^3.0.0 and `@actions/github` to ^9.0.0, and set `engines.node` to `>=20.0.0` to match upstream.
6+
7+
**@actions/core** ([actions/toolkit `packages/core/RELEASES.md`](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md))
8+
9+
- **v3.0.0**: ESM-only release; CommonJS callers must use dynamic `import()` instead of `require()`. `@codecov/bundler-plugin-core` already ships as ESM (`"type": "module"`), so this does not change how the package is consumed from modern bundlers and Node ESM.
10+
- **v2.x** (between 1.x and 3.x): Node 24 support and `@actions/http-client` upgrades (including 3.x in the 2.x line).
11+
12+
**@actions/github** ([actions/toolkit `packages/github/RELEASES.md`](https://github.com/actions/toolkit/blob/main/packages/github/RELEASES.md))
13+
14+
- **v9.0.0**: ESM-only (same consideration as `@actions/core` for this package). Release notes also note improved TypeScript behavior with ESM and `@octokit/core/types`.
15+
- **v8.0.0**: **Minimum Node.js is now 20** (previously 18); Octokit dependencies move to current major lines (`@octokit/core`, REST plugins, request stack).
16+
- **v8.0.1**: Dependency updates (`undici`, `@actions/http-client`).
17+
18+
**Impact here**
19+
20+
- Runtime behavior we rely on is unchanged: `context` for GitHub Actions metadata and `getIDToken()` for OIDC uploads are still the supported APIs.
21+
- **Node 18** is no longer a supported runtime for this package; use **Node 20+** (aligned with `@actions/github` 8+ and this repo’s Volta pin on Node 20).

packages/bundler-plugin-core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
"generate:typedoc": "typedoc --options ./typedoc.json"
4040
},
4141
"dependencies": {
42-
"@actions/core": "^1.10.1",
43-
"@actions/github": "^6.0.0",
42+
"@actions/core": "^3.0.0",
43+
"@actions/github": "^9.0.0",
4444
"chalk": "4.1.2",
4545
"semver": "^7.5.4",
4646
"unplugin": "^1.10.1",
@@ -66,6 +66,6 @@
6666
"extends": "../../package.json"
6767
},
6868
"engines": {
69-
"node": ">=18.0.0"
69+
"node": ">=20.0.0"
7070
}
7171
}

packages/bundler-plugin-core/src/utils/providers/__tests__/GitHubActions.test.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as GitHub from "@actions/github";
21
import { HttpResponse, http } from "msw";
32
import { setupServer } from "msw/node";
43
import { createEmptyArgs } from "../../../../test-utils/helpers.ts";
@@ -26,10 +25,25 @@ const mocks = vi.hoisted(() => ({
2625
headLabel: vi.fn().mockReturnValue(""),
2726
}));
2827

28+
/** Holds overrides; @actions/github v9+ exports `context` as read-only in ESM. */
29+
const mockGitHubContext = vi.hoisted(() => ({
30+
override: undefined as
31+
| undefined
32+
| {
33+
eventName: string;
34+
payload: Record<string, unknown>;
35+
},
36+
}));
37+
2938
vi.mock("@actions/github", async (importOriginal) => {
3039
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
3140
const original = await importOriginal<typeof import("@actions/github")>();
32-
return original;
41+
return {
42+
...original,
43+
get context() {
44+
return mockGitHubContext.override ?? original.context;
45+
},
46+
};
3347
});
3448

3549
beforeAll(() => {
@@ -38,6 +52,7 @@ beforeAll(() => {
3852

3953
afterEach(() => {
4054
server.resetHandlers();
55+
mockGitHubContext.override = undefined;
4156
vi.resetAllMocks();
4257
});
4358

@@ -67,10 +82,9 @@ describe("GitHub Actions Params", () => {
6782
// TODO: verify that empty string belongs here, from a glance it seems PushEvent does not
6883
// include a pull_request key
6984
if (["pull_request", "pull_request_target", ""].includes(eventName)) {
70-
vi.mocked(GitHub).context = {
85+
mockGitHubContext.override = {
7186
eventName,
7287
payload: {
73-
// @ts-expect-error - forcing the payload to be a PullRequestEvent
7488
pull_request: {
7589
head: {
7690
sha: "test-head-sha",
@@ -84,8 +98,7 @@ describe("GitHub Actions Params", () => {
8498
},
8599
};
86100
} else if (eventName === "merge_group") {
87-
// @ts-expect-error - forcing the payload to be a MergeGroupEvent
88-
vi.mocked(GitHub).context = {
101+
mockGitHubContext.override = {
89102
eventName,
90103
payload: {
91104
merge_group: {

0 commit comments

Comments
 (0)