Skip to content

Conversation

@Satishchoudhary94
Copy link

Problem

Yarn v4+ requires corepack, but the action tried to use yarn v1.22.22 from the system,
causing the error:

Solution

  • Automatically enable corepack before checking yarn version (for Node 16.9+)
  • Detect corepack errors and provide clear, actionable messages
  • Users can either enable corepack first or disable caching

Changes

  • Added enableCorepackIfSupported() helper function
  • Updated yarn getCacheFolderPath() to enable corepack and detect version mismatch errors
  • Improved error messages with links to GitHub issue

Testing

  • Builds successfully without errors
  • Error messages guide users to solution

…r handling

This change improves the action's handling of yarn v4+ which requires corepack.

Changes:
- Add enableCorepackIfSupported() helper function to automatically enable corepack
- Update yarn getCacheFolderPath to call corepack enable before checking yarn version
- Detect corepack-related errors and provide clear, actionable error messages
- Users can either enable corepack before the action or disable caching

The error message now clearly explains:
- The requirement for corepack with yarn v4+
- How to enable corepack: 'corepack enable'
- Alternative: disable caching with 'package-manager-cache: false'
- Link to GitHub issue for more context

Fixes actions#1027
Related: actions#1027
@Satishchoudhary94 Satishchoudhary94 requested a review from a team as a code owner January 18, 2026 14:17
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.

1 participant