build(check-and-move-issue-based-on-labels-v1): migrate to ESM + node:test#394
Merged
Garbee merged 4 commits intoJun 22, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates the check-and-move-issue-based-on-labels-v1 GitHub Action workspace from the Mocha/nyc/ts-node/ncc toolchain to an ESM + node:test + tsx + esbuild-based setup, aligning with the per-workspace migration approach described in #361/#360.
Changes:
- Switch workspace to ESM (
"type": "module") and update scripts to use sharedbuild-action.mjsplus a singlenode --test+ coveragetestcommand. - Add per-workspace
node.config.jsonfortsxloading, reporter config, and coverage thresholds. - Rewrite tests to
node:testand Node’s built-in mocking (mock.module,mock.fn); regeneratedist/and drop committed.d.tsartifacts.
Reviewed changes
Copilot reviewed 5 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/actions/check-and-move-issue-based-on-labels-v1/package.json | Switch to ESM; replace build/test tooling; add typecheck; remove nyc config. |
| .github/actions/check-and-move-issue-based-on-labels-v1/node.config.json | Configure tsx loader, test reporter, and coverage include/exclude + thresholds. |
| .github/actions/check-and-move-issue-based-on-labels-v1/tsconfig.json | Add interim ESM/bundler resolution overrides and exclude dist/. |
| .github/actions/check-and-move-issue-based-on-labels-v1/src/run.test.ts | Port tests to node:test + mock.module/mock.fn. |
| .github/actions/check-and-move-issue-based-on-labels-v1/src/getIssueLabels.test.ts | Port tests to node:test + mock.fn. |
| .github/actions/check-and-move-issue-based-on-labels-v1/dist/licenses.txt | Refresh generated license bundle output. |
| .github/actions/check-and-move-issue-based-on-labels-v1/dist/check-and-move-issue-based-on-labels-v1/src/types.d.ts | Remove previously committed generated .d.ts artifact. |
| .github/actions/check-and-move-issue-based-on-labels-v1/dist/check-and-move-issue-based-on-labels-v1/src/run.d.ts | Remove previously committed generated .d.ts artifact. |
| .github/actions/check-and-move-issue-based-on-labels-v1/dist/check-and-move-issue-based-on-labels-v1/src/index.d.ts | Remove previously committed generated .d.ts artifact. |
| .github/actions/check-and-move-issue-based-on-labels-v1/dist/check-and-move-issue-based-on-labels-v1/src/getIssueLabels.d.ts | Remove previously committed generated .d.ts artifact. |
| .github/actions/check-and-move-issue-based-on-labels-v1/dist/add-to-board-v1/src/moveIssueToColumn.d.ts | Remove previously committed generated .d.ts artifact. |
| .github/actions/check-and-move-issue-based-on-labels-v1/dist/add-to-board-v1/src/getProjectBoardID.d.ts | Remove previously committed generated .d.ts artifact. |
| .github/actions/check-and-move-issue-based-on-labels-v1/dist/add-to-board-v1/src/getProjectBoardFieldList.d.ts | Remove previously committed generated .d.ts artifact. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…pinned toolchain The committed bundle was built with a stale/non-pinned esbuild and baked machine-absolute paths into module-annotation comments. Rebuilding with the repo's pinned esbuild emits repo-relative paths; the bundle is now byte-deterministic across builds.
- Import Core/GitHub as type-only (they have no runtime bindings). - Align the mock.module specifiers with the extensionless paths run.ts imports, so the mocks reliably intercept the same module. - Fix a test description that referenced label-prefixes-to-match twice; it should be the match vs exclude inputs.
…:test (#399) ## Problem Part of #361 — converting each buildable action workspace off the old toolchain (`ts-node` + `mocha` + `nyc` + `chai`/`sinon` + `ncc`) onto `node:test` + `tsx` + `esbuild`, so dependencies can be updated without the TS6/ts-node breakage. Follows the exemplar #360 (`get-release-issue-v1`). > **Stacked on #394** (`check-and-move-issue-based-on-labels-v1`). This action imports the real `getIssueLabels` from that sibling and exercises it (no module mock), so it needs the sibling's ESM conversion present to be green. Base is `chore/migrate-check-and-move-issue-based-on-labels-v1`; the diff here is **only** this workspace. **Retarget to `main` after #394 merges.** ## Approach Migrate this one workspace, fully self-contained and green on its own. Coverage is no longer a separate step — the single `test` script always runs Node's built-in coverage and enforces the thresholds from `node.config.json`. The root toolchain stays CommonJS; this workspace gets an interim `tsconfig` override that is removed in the final flip PR. ## Changes (`label-issue-based-on-existing-labels-v1`) - **`package.json`** — `"type": "module"`; a single `test` script running `node --experimental-default-config-file --experimental-test-module-mocks --experimental-test-coverage --test --test-force-exit 'src/**/*.test.ts'`; `build` via the shared `node ../../../scripts/build-action.mjs`; `typecheck: tsc --noEmit`; removed the `nyc` block (thresholds moved to `node.config.json`). - **`node.config.json`** (new) — `--experimental-default-config-file` source: `import: ["tsx"]`, `test-reporter: ["spec"]`, coverage include `src/**/*.ts` (excluding `src/**/*.test.ts`, `src/index.ts`), with the original **100 / 85 / 100** line / branch / function thresholds. - **`tsconfig.json`** — interim ESM override (`module: esnext`, `moduleResolution: bundler`, `allowImportingTsExtensions`, `noEmit`) so this workspace is ESM while the repo root is still CommonJS. Removed in the final flip PR. - **Tests** (`run.test.ts`) — rewritten to `node:test` / `node:assert` / `mock.module` (replaces mocha/chai/sinon). - **`dist/`** — regenerated as an ESM esbuild bundle; the ncc `.d.ts` artifacts are dropped and `dist/licenses.txt` is refreshed. (`dist/**` is `linguist-generated`, so it collapses in the diff.) - **CI** — this workspace has no dedicated job in `.github/workflows/tests.yml`; that file is unchanged. ## Verification Locally (node 24), this workspace only: - `npm run typecheck -w label-issue-based-on-existing-labels-v1` — green - `npm run lint -w label-issue-based-on-existing-labels-v1` — green - `npm run test -w label-issue-based-on-existing-labels-v1` — green (single command runs `node:test` **with coverage**; 100% lines / 85% branches / 100% functions enforced from `node.config.json`) - `npm run build -w label-issue-based-on-existing-labels-v1` — green (esbuild ESM `dist/index.js` + regenerated `dist/licenses.txt`) Closes: #379
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Part of #361 — converting each buildable action workspace off the old toolchain (
ts-node+mocha+nyc+chai/sinon+ncc) ontonode:test+tsx+esbuild, so dependencies can be updated without the TS6/ts-node breakage. Follows the exemplar #360 (get-release-issue-v1).Approach
Migrate this one workspace, fully self-contained and green on its own. Coverage is no longer a separate step — the single
testscript always runs Node's built-in coverage and enforces the thresholds fromnode.config.json. The root toolchain stays CommonJS; this workspace gets an interimtsconfigoverride that is removed in the final flip PR.Changes (
check-and-move-issue-based-on-labels-v1)package.json—"type": "module"; a singletestscript runningnode --experimental-default-config-file --experimental-test-module-mocks --experimental-test-coverage --test --test-force-exit 'src/**/*.test.ts';buildvia the sharednode ../../../scripts/build-action.mjs;typecheck: tsc --noEmit; removed thenycblock (thresholds moved tonode.config.json).node.config.json(new) —--experimental-default-config-filesource:import: ["tsx"],test-reporter: ["spec"], coverage includesrc/**/*.ts(excludingsrc/**/*.test.ts,src/index.ts), with the original 100 / 85 / 100 line / branch / function thresholds.tsconfig.json— interim ESM override (module: esnext,moduleResolution: bundler,allowImportingTsExtensions,noEmit) so this workspace is ESM while the repo root is still CommonJS. Removed in the final flip PR.getIssueLabels.test.ts,run.test.ts) — rewritten tonode:test/node:assert/mock.module(replaces mocha/chai/sinon).dist/— regenerated as an ESM esbuild bundle; the ncc.d.tsartifacts are dropped anddist/licenses.txtis refreshed. (dist/**islinguist-generated, so it collapses in the diff.).github/workflows/tests.yml; that file is unchanged.Verification
Locally (node 24), this workspace only:
npm run typecheck -w check-and-move-issue-based-on-labels-v1— greennpm run lint -w check-and-move-issue-based-on-labels-v1— greennpm run test -w check-and-move-issue-based-on-labels-v1— green (single command runsnode:testwith coverage; 100% lines / 85% branches / 100% functions enforced fromnode.config.json)npm run build -w check-and-move-issue-based-on-labels-v1— green (esbuild ESMdist/index.js+ regenerateddist/licenses.txt)Closes: #375