Skip to content

Conversation

@danwkennedy
Copy link
Contributor

@danwkennedy danwkennedy commented Jan 29, 2026

Description

We're converting all packages in this repo to ESM modules. @actions/cache is one of leaf packages and can be converted now.

@danwkennedy danwkennedy requested a review from a team as a code owner January 29, 2026 17:07
Copilot AI review requested due to automatic review settings January 29, 2026 17:07
@danwkennedy danwkennedy requested a review from a team as a code owner January 29, 2026 17:07
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

This PR converts the @actions/cache package from CommonJS to ESM-only, marking it as a major breaking change with version 6.0.0. The conversion aligns with the broader ESM migration across the GitHub Actions toolkit packages.

Changes:

  • Package converted to ESM with "type": "module" and exports configuration
  • TypeScript configured for ESM output with module: "node16" and moduleResolution: "node16"
  • All relative imports updated with .js extensions for ESM compatibility
  • Dependencies upgraded to ESM-compatible versions (@actions/core 3.0.0, @actions/exec 3.0.0, etc.)
  • Created package-version.cjs CommonJS wrapper to read package.json version in ESM context
  • Removed direct dependency on @azure/abort-controller in favor of global AbortController (Node.js 18+)
  • Jest configuration updated to handle ESM cache module

Reviewed changes

Copilot reviewed 13 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/cache/package.json Updated to version 6.0.0, added ESM configuration, upgraded dependencies to latest ESM-compatible versions, updated build script
packages/cache/tsconfig.json Added ESM module settings (node16) for proper module resolution
packages/cache/src/cache.ts Updated all relative imports to include .js extensions
packages/cache/src/internal/*.ts Updated all relative imports to include .js extensions across all internal modules
packages/cache/src/internal/shared/user-agent.ts Refactored to import version from new package-version.cjs file
packages/cache/src/internal/shared/package-version.cjs New CommonJS module to provide package version to ESM modules
packages/cache/src/generated/**/*.ts Updated generated protobuf code with .js extensions in relative imports
packages/cache/package-lock.json Updated all dependency versions consistently with package.json changes
packages/cache/RELEASES.md Added 6.0.0 release notes documenting ESM-only breaking change
jest.config.js Added @actions/cache module mapping and transform patterns for ESM testing
Files not reviewed (1)
  • packages/cache/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

yacaovsnc
yacaovsnc previously approved these changes Jan 29, 2026
@danwkennedy danwkennedy force-pushed the danwkennedy/actions-cache-esm branch from ae07f21 to 73faff4 Compare January 29, 2026 18:32
@danwkennedy danwkennedy merged commit ae29a27 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.

4 participants