Skip to content

Conversation

Copy link

Copilot AI commented Feb 3, 2026

@actions/core v3 is ESM-only ("type": "module"), breaking the existing CommonJS build pipeline. The bundler (ncc) and test framework (Jest) failed to resolve ESM imports.

Changes

Package & TypeScript

  • Added "type": "module" to package.json
  • Updated tsconfig.json: module: "ES2022", esModuleInterop: true

Test Configuration

  • Converted jest.config.js → jest.config.mjs with ts-jest ESM preset
  • Added NODE_OPTIONS experimental-vm-modules flag
  • Configured moduleNameMapper for @actions packages

Dependencies

  • Replaced actions-toolkit (CommonJS) with @actions/github v9 (ESM)
  • Updated getUserInfo() to use getOctokit() API

Build Output

  • ncc now emits ESM bundle with lib/package.json type marker
  • Renamed .prettierrc.js → .prettierrc.cjs for compatibility
// Before: actions-toolkit (incompatible)
const toolkit = new Toolkit({ secrets: [...] });
const res = await toolkit.github.users.getByUsername({username});

// After: @actions/github (ESM-compatible)
const octokit = getOctokit(getInput('github_token'));
const res = await octokit.rest.users.getByUsername({username});

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 3, 2026 11:13
- Add "type": "module" to package.json for ESM support
- Update TypeScript config to output ES2022 modules with esModuleInterop
- Convert Jest config to ESM (.mjs) with proper ts-jest ESM preset
- Rename .prettierrc.js to .prettierrc.cjs for CommonJS compatibility
- Replace actions-toolkit with @actions/github for ESM compatibility
- Configure Jest to handle ESM modules from @actions packages
- Update test script to use NODE_OPTIONS for experimental VM modules
- Build now outputs ESM format successfully

Co-authored-by: EndBug <26386270+EndBug@users.noreply.github.com>
Properly access github_token input using the getInput helper function
from io.ts instead of directly accessing process.env.

Co-authored-by: EndBug <26386270+EndBug@users.noreply.github.com>
Copilot AI changed the title [WIP] Update @actions/core package to version 3.0.0 chore(deps): update build process for ESM-only @actions/core v3 Feb 3, 2026
Copilot AI requested a review from EndBug February 3, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants