@actions/artifact: convert to an ESM module#2266
Merged
danwkennedy merged 11 commits intomainfrom Jan 29, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Converts @actions/artifact to an ESM package (v6) by updating TypeScript/Node module settings, switching internal imports to .js extensions, and aligning dependencies/tests with ESM execution.
Changes:
- Update
packages/artifactTypeScript + package metadata for ESM (moduleResolution: node16,"type": "module",exports). - Rewrite internal/source/test imports to include
.jsextensions and update generated exports/imports accordingly. - Refresh dependencies (Octokit,
jwt-decode, etc.) and adjust Jest configuration/mappers to run tests against built ESM outputs.
Reviewed changes
Copilot reviewed 31 out of 36 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/artifact/tsconfig.json | Enables Node16 ESM module + resolution for artifact package builds. |
| packages/artifact/src/internal/upload/zip.ts | Updates internal imports to .js for ESM compatibility. |
| packages/artifact/src/internal/upload/upload-zip-specification.ts | Updates internal import to .js. |
| packages/artifact/src/internal/upload/upload-artifact.ts | Updates internal/generated imports to .js and uses generated index entrypoint. |
| packages/artifact/src/internal/upload/retention.ts | Switches generated import to ../../generated/index.js. |
| packages/artifact/src/internal/upload/blob-upload.ts | Updates internal imports to .js. |
| packages/artifact/src/internal/shared/util.ts | Updates config import to .js and switches to jwtDecode named import. |
| packages/artifact/src/internal/shared/user-agent.ts | Replaces require(package.json) with a hardcoded version constant. |
| packages/artifact/src/internal/shared/artifact-twirp-client.ts | Updates internal/generated imports to .js. |
| packages/artifact/src/internal/find/retry-options.ts | Changes OctokitOptions import source. |
| packages/artifact/src/internal/find/list-artifacts.ts | Updates internal/generated imports to .js and changes OctokitOptions import source. |
| packages/artifact/src/internal/find/get-artifact.ts | Updates internal/generated imports to .js and changes OctokitOptions import source. |
| packages/artifact/src/internal/download/download-artifact.ts | Updates internal/generated imports to .js. |
| packages/artifact/src/internal/delete/delete-artifact.ts | Updates internal/generated imports to .js and changes OctokitOptions import source. |
| packages/artifact/src/internal/client.ts | Updates internal imports to .js; GHES guards are commented out in multiple methods. |
| packages/artifact/src/generated/results/api/v1/artifact.twirp-client.ts | Updates generated relative import to .js. |
| packages/artifact/src/generated/results/api/v1/artifact.ts | Updates generated dependency imports to .js. |
| packages/artifact/src/generated/index.ts | Adds .js extensions to generated export barrel. |
| packages/artifact/src/artifact.ts | Updates public entry imports/exports to .js. |
| packages/artifact/package.json | Bumps major version, sets "type": "module", adds exports, updates deps/devDeps. |
| packages/artifact/package-lock.json | Updates lockfile for new deps; includes a local link entry for @actions/http-client. |
| packages/artifact/jest.config.cjs | Adds package-scoped Jest config with ESM-related mappers/transform settings. |
| packages/artifact/tests/util.test.ts | Updates test imports to .js. |
| packages/artifact/tests/upload-zip-specification.test.ts | Updates test imports to .js. |
| packages/artifact/tests/upload-artifact.test.ts | Updates test imports to .js and generated index entrypoint. |
| packages/artifact/tests/retention.test.ts | Updates test imports to .js and generated index entrypoint. |
| packages/artifact/tests/path-and-artifact-name-validation.test.ts | Updates test imports to .js. |
| packages/artifact/tests/list-artifacts.test.ts | Updates test imports to .js and generated index entrypoint. |
| packages/artifact/tests/get-artifact.test.ts | Updates test imports to .js and generated index entrypoint. |
| packages/artifact/tests/download-artifact.test.ts | Updates test imports to .js and generated index entrypoint. |
| packages/artifact/tests/delete-artifacts.test.ts | Updates test imports to .js and generated index entrypoint. |
| packages/artifact/tests/config.test.ts | Updates test import to .js. |
| packages/artifact/tests/artifact-http-client.test.ts | Updates test imports to .js. |
| packages/artifact/RELEASES.md | Normalizes heading levels/formatting for historical release notes. |
| packages/artifact/README.md | Minor markdown cleanup. |
| jest.config.js | Adds moduleNameMapper entries and ts-jest module settings to support ESM builds during tests. |
Files not reviewed (1)
- packages/artifact/package-lock.json: Language not supported
Comments suppressed due to low confidence (4)
packages/artifact/src/internal/client.ts:182
- The GHES guard has been commented out. This changes runtime behavior (GHES environments will now proceed instead of throwing) and also leaves
isGhes/GHESNotSupportedErroras unused imports under the repo’s@typescript-eslint/no-unused-varsrule. Please either restore theisGhes()check (preferred if GHES is still unsupported) or fully remove the GHES codepath/imports if support is intentionally changing, and update documentation/changelog accordingly.
try {
// if (isGhes()) {
// throw new GHESNotSupportedError()
// }
packages/artifact/src/internal/client.ts:219
- The GHES guard has been commented out. This changes runtime behavior (GHES environments will now proceed instead of throwing) and also leaves
isGhes/GHESNotSupportedErroras unused imports under the repo’s@typescript-eslint/no-unused-varsrule. Please either restore theisGhes()check (preferred if GHES is still unsupported) or fully remove the GHES codepath/imports if support is intentionally changing, and update documentation/changelog accordingly.
try {
// if (isGhes()) {
// throw new GHESNotSupportedError()
// }
packages/artifact/src/internal/client.ts:122
- The GHES guard has been commented out. This changes runtime behavior (GHES environments will now proceed instead of throwing) and also leaves
isGhes/GHESNotSupportedErroras unused imports under the repo’s@typescript-eslint/no-unused-varsrule. Please either restore theisGhes()check (preferred if GHES is still unsupported) or fully remove the GHES codepath/imports if support is intentionally changing, and update documentation/changelog accordingly.
try {
// if (isGhes()) {
// throw new GHESNotSupportedError()
// }
packages/artifact/src/internal/client.ts:255
- The GHES guard has been commented out. This changes runtime behavior (GHES environments will now proceed instead of throwing) and also leaves
isGhes/GHESNotSupportedErroras unused imports under the repo’s@typescript-eslint/no-unused-varsrule. Please either restore theisGhes()check (preferred if GHES is still unsupported) or fully remove the GHES codepath/imports if support is intentionally changing, and update documentation/changelog accordingly.
try {
// if (isGhes()) {
// throw new GHESNotSupportedError()
// }
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bf0788d to
73a0f27
Compare
yacaovsnc
approved these changes
Jan 29, 2026
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.
Description
In order to fully remove a dependency on an unsafe version of
undici,@actions/artifactneeds to be converted to an ESM module (to take an updated version of@actions/githubwhich was itself converted to an ESM module).Note this is a breaking change and will bump
@actions/artifact's version tov6.0.0fromv5.0.3.