Skip to content

Commit 08512e8

Browse files
chore(bundler-plugin-core): bump @actions/core and @actions/github (#322)
1 parent c1737d0 commit 08512e8

File tree

5 files changed

+220
-14
lines changed

5 files changed

+220
-14
lines changed

.changeset/bump-actions-toolkit.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
"@codecov/bundler-plugin-core": major
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. **Semver major** because supported Node.js drops below 20 (breaking for anyone still on Node 18).
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; apps that `require("@actions/core")` directly must use dynamic `import()`. **`@codecov/bundler-plugin-core` bundles `@actions/core` and `@actions/github` into `dist/index.cjs`**, so `require("@codecov/bundler-plugin-core")` (e.g. Rollup/Webpack CJS configs) keeps working.
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+
- **Build**: unbuild inlines `@actions/*` (and their transitive deps) like `@sentry/core`; `failOnWarn: false` suppresses expected “inlined implicit external” noise. Published `dist` is larger (~9 MB CJS) but avoids `ERR_PACKAGE_PATH_NOT_EXPORTED` for CJS consumers.
22+
- **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/build.config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ export default defineBuildConfig({
77
outDir: "dist",
88
declaration: "compatible",
99
sourcemap: true,
10+
// Inlining @actions/* pulls transitive deps (octokit, undici, …); unbuild warns about each.
11+
failOnWarn: false,
1012
rollup: {
1113
dts: {
1214
compilerOptions: {
@@ -29,7 +31,13 @@ export default defineBuildConfig({
2931
isResolved?: boolean,
3032
) => boolean;
3133
opts.external = (source, importer, isResolved) => {
32-
if (source === "@sentry/core") {
34+
// Bundle these into dist so CJS consumers never `require()` them.
35+
// @actions/* v3+ is ESM-only (no CJS "main"); externalizing breaks Rollup/Webpack CJS configs.
36+
if (
37+
source === "@sentry/core" ||
38+
source === "@actions/core" ||
39+
source === "@actions/github"
40+
) {
3341
return false;
3442
}
3543
return isExternal(source, importer, isResolved);

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)