Skip to content

Conversation

SukkaW
Copy link

@SukkaW SukkaW commented Sep 10, 2025

Description:

The PR follows #1348 with a bugfix and a very slight performance improvement.

  • Only enable package cache when the cache feature is available
  • Don't read package.json if the previous version's cache config is used
    • We don't have to determine the package manager if the user has explicitly specified which package manager to use, which improves performance a little.

Related issue:

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

- Only enable package cache when the cache feature is availiable
- We don't read "package.json" if previous version "cache" field is used
@Copilot Copilot AI review requested due to automatic review settings September 10, 2025 17:29
@SukkaW SukkaW requested a review from a team as a code owner September 10, 2025 17:29
Copy link

@Copilot 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 refactors the caching logic in the main setup-node workflow to improve performance and properly guard cache functionality. The changes ensure package cache is only enabled when the cache feature is available and avoid unnecessary package.json reads when the cache field is explicitly specified.

  • Only enable package manager caching when the cache feature is available by wrapping logic with isCacheFeatureAvailable()
  • Defer reading package.json until needed by moving getNameFromPackageManagerField() call inside conditional blocks
  • Restructure cache logic to prioritize explicit cache input over automatic package manager detection

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@SukkaW
Copy link
Author

SukkaW commented Sep 10, 2025

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