Skip to content

@actions/artifact: convert to an ESM module#2266

Merged
danwkennedy merged 11 commits intomainfrom
danwkennedy/artifact-esm-module
Jan 29, 2026
Merged

@actions/artifact: convert to an ESM module#2266
danwkennedy merged 11 commits intomainfrom
danwkennedy/artifact-esm-module

Conversation

@danwkennedy
Copy link
Contributor

@danwkennedy danwkennedy commented Jan 28, 2026

Description

In order to fully remove a dependency on an unsafe version of undici, @actions/artifact needs to be converted to an ESM module (to take an updated version of @actions/github which was itself converted to an ESM module).

Note this is a breaking change and will bump @actions/artifact's version to v6.0.0 from v5.0.3.

@danwkennedy danwkennedy requested a review from a team as a code owner January 28, 2026 17:56
Copilot AI review requested due to automatic review settings January 28, 2026 17:56
@danwkennedy danwkennedy requested a review from a team as a code owner January 28, 2026 17:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/artifact TypeScript + package metadata for ESM (moduleResolution: node16, "type": "module", exports).
  • Rewrite internal/source/test imports to include .js extensions 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/GHESNotSupportedError as unused imports under the repo’s @typescript-eslint/no-unused-vars rule. Please either restore the isGhes() 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/GHESNotSupportedError as unused imports under the repo’s @typescript-eslint/no-unused-vars rule. Please either restore the isGhes() 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/GHESNotSupportedError as unused imports under the repo’s @typescript-eslint/no-unused-vars rule. Please either restore the isGhes() 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/GHESNotSupportedError as unused imports under the repo’s @typescript-eslint/no-unused-vars rule. Please either restore the isGhes() 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.

@danwkennedy danwkennedy force-pushed the danwkennedy/artifact-esm-module branch from bf0788d to 73a0f27 Compare January 29, 2026 02:50
@danwkennedy danwkennedy merged commit 5793b08 into main Jan 29, 2026
17 checks passed
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