Repository navigation
Description
Description
The @actions/* toolkit has gone ESM-only at its next major. This repo is
CommonJS end to end, so all three pending majors are unlandable individually and
must move together:
@actions/corev3 (build(npm): update dependency @actions/core to v3 #49)@actions/githubv9 (build(npm): update dependency @actions/github to v9 #50)@actions/http-clientv4 (build(npm): update dependency @actions/http-client to v4 #51)
Each ships "type": "module" with an exports map exposing only an "import"
condition — no "require", no CJS entry point at all. ncc, bundling
commit-runner.ts for a CJS target, cannot resolve them:
Error: Module not found: Error: Package path . is not exported from package
.../node_modules/@actions/github (see exports field in package.json)
and Jest cannot even load them:
FAIL src/__tests__/unit/commit-runner.test.ts
● Test suite failed to run
Cannot find module '@actions/core' from 'src/__tests__/unit/commit-runner.test.ts'
This is not an overrides problem. Both were tested directly: removing the
@actions/http-client / undici pins from overrides, reinstalling, and re-running
reproduced byte-identical failures. Lifting the pins changes nothing.
⚠️ #51 is green and must NOT be merged
@actions/http-client v4 (#51) passes CI. It is green only because CI never
bundles — the workflows run just sync / just precommit / just test and never
call just bundle. npm run bundle fails on it exactly as it does on #49/#50.
Merging #51 would leave dev in a state where dist/ cannot be rebuilt, and the
failure would surface later in the release cycle, on a change CI had already declared
safe. It is held for that reason, not merged.
What the migration involves
package.json— add"type": "module".tsconfig.json—module/moduleResolutiontonode16/nodenext
(orbundler). The current"moduleResolution": "node"(classic) is load-bearing
in two ways beyond ESM:- it is removed in TypeScript 7 (
error TS5108, see build(npm): update dependency typescript to v7 #54), and - it ignores
exportsmaps, which silently degrades types: under
@actions/githubv9 the@octokit/core/typesimport fails to resolve and
octokit.rest.*collapses toany. Verified by probe:
octokit.rest.git.createBlobtypes as() => any. Fixing
moduleResolutionrestores real Octokit types tosrc/commit.ts, which are
currently unchecked — expect latent type errors to surface, and treat that as
the point of the exercise rather than a regression. libneedsES2022(@octokit/request-erroruses the ES2022ErrorOptions).
- it is removed in TypeScript 7 (
- Jest — ESM mode (or a transform that handles it). The existing manual mock for
@actions/github(added in v0.1.3, see CHANGELOG) will need reworking. - Bundling — confirm
ncccan emit a working entry point from ESM sources, or
replace it withesbuild.action.yml'smain: "dist/index.js"must keep working
on thenode24runtime. - Verify for real — the bundled
dist/index.jsmust actually execute in a
workflow. Unit tests passing is not sufficient evidence here; the whole class of
bug in this issue is invisible to the current test suite.
Acceptance
@actions/corev3,@actions/githubv9,@actions/http-clientv4 all installed.npm run lint/build/test/bundleall pass.- Bundled action runs end to end in a real workflow (signed-commit REST flow).
overridesfor@actions/http-client/undicire-evaluated — they may become
unnecessary once the toolkit pulls its own current deps.
Notes
Sizing: this is a real migration touching the build pipeline, not a dependency bump.
Independent estimates from two separate investigations landed at roughly half a day
to a day, dominated by the bundler and by re-verifying the REST flow against real
Octokit v7 response shapes (currently any-typed, therefore unvalidated).
Activity
test(e2e): execute the committed bundle against the real GitHub API
build(esm): migrate action and test suite to ESM (#74)
c-vigo commentedon Jul 14, 2026
Done — shipped to
devin #74 (a624eb2). Closes #49, #50, #51 (all three auto-closed on merge) and unblocks #54.Acceptance
@actions/corev3,@actions/githubv9,@actions/http-clientv4 all installed.lint/build/test/bundleall pass. 84/84 tests, 0tscerrors, 92.5% coverage.overridesre-evaluated: the@actions/http-clientandundicipins are both removed. Thehttp-clientpin (3.0.2) was what actually blocked the v4 major; theundicipin is redundant, sincehttp-clientv4 depends onundici: ^6.23.0which resolves to the same6.27.0the pin forced.npm audit --omit=devis clean.Two latent problems the migration surfaced — both invisible to the test suite
1. The bundled action was a silent no-op. The CJS
require.main === moduleentry guard does not survive bundling to ESM: ncc rewrites it to__nccwpck_require__.c[__nccwpck_require__.s] === module, which evaluates false. The bundle loaded, exited 0, and committed nothing — with all 84 unit tests passing. Replaced with animport.meta.url/process.argv[1]comparison.This is exactly the class of bug the issue warned about ("unit tests passing is not sufficient evidence"). Nothing in CI could have caught it: the unit tests import
main()directly, and the repo dogfoods commit-action at a pinned released SHA, never at./— sodist/index.jswas never executed by anything.2. The signed-commit REST flow was never type-checked. As predicted, classic
moduleResolution: nodeignoresexportsmaps, so@octokit/core/typesnever resolved and everyoctokit.rest.*call incommit.tsdegraded toany. Undernodenextthey type-check against real Octokit types. No latent type errors surfaced —commit.tswas already correct, just unverified.Gap closed permanently
Added an
e2e-smokeworkflow that runs the action as a consumer does (uses: ./) on every PR: it commits to a scratch branch through the realcreateBlob → createTree → createCommit → updateRefflow, then asserts the commit exists, is signed, and round-trips the expected content, and deletes the branch. Passed on first run against the real API under Octokit v7:The non-empty
commit-shaassertion is specifically what catches the no-op failure mode.Closing (merged to
dev, so it will not auto-close until release).fix(npm): lint and format the whole source tree, not one file (#75)
chore: release 0.3.0 (#78)
ci: poll scratch-branch head in smoke verify steps to absorb replicat…
chore: release 0.3.1 (#103)