fix(#1027): Improve yarn v4+ corepack support with better error handling by Satishchoudhary94 · Pull Request #1479 · actions/setup-node

@Satishchoudhary94

@Satishchoudhary94

…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