Repository navigation
Commit 9d72982
Bump @actions/core from 2.0.2 to 3.0.1 and migrate action to ESM
@actions/core 3.0.0 is ESM-only ("type": "module", and its exports map
offers only an "import" condition). The upstream release notes state
that "CommonJS consumers must use dynamic import() instead of
require()", so a plain version bump cannot work: ncc failed with
"Package path . is not exported from package @actions/core", which
also aborted `npm ci` via the prepare script and took the units job
down with it.
Migrate the action to ESM instead:
- Add "type": "module" and convert index.js and find-python-projects.js
to import/export. ncc then bundles dist/index.js as ESM and emits its
own dist/package.json type marker plus sourcemap-register.cjs,
replacing the now-stale sourcemap-register.js.
- Rewrite the test mocks. ESM namespace objects are sealed, so
jest.spyOn can no longer patch @actions/core or the local module;
both tests now use jest.unstable_mockModule ahead of a dynamic
import. Native ESM in Jest needs --experimental-vm-modules, so the
test script invokes jest through node directly.
- Point eslint at the new module system (sourceType module, ecmaVersion
2022 for top-level await) and drop the commonjs globals.
Also declares globals, @eslint/js and @eslint/eslintrc, which
eslint.config.cjs requires but nothing depended on. These stopped being
hoisted transitives when eslint 10 landed in #113, so `npm run lint`
had been failing outright on main; declaring them is what makes the
lint change above verifiable.
action.yml is unchanged: the node20 runtime runs ESM fine, and
@actions/core 3 sets no engines constraint. All 4 snapshots still match
byte-for-byte, so behavior is unchanged.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 6d07cb7 commit 9d72982
12 files changed
Lines changed: 671 additions & 626 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
0 commit comments