Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added Node version to cache key #1172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
clintonb wants to merge 1 commit into actions:main
base: main
Choose a base branch
Loading
from voriteam:clintonb/node-version-cache-key

Conversation

Copy link

@clintonb clintonb commented Dec 14, 2024

Description:
The Node.js version is now included in the cache key to ensure caches are invalidated, and dependencies reinstalled, when changing Node.js versions.

Related issue:
Fixes #1171

Check list:

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

alexdunae reacted with thumbs up emoji Furka-090 reacted with confused emoji
@clintonb clintonb requested a review from a team as a code owner December 14, 2024 07:46
Copy link

Shouldn't this use the actual major Node version in the cache key? The linked issue says:

The major version number, (e.g., 22 in 22.12) should be used to avoid unnecessary invalidation when upgrading to patch or minor versions.

That makes sense to me. But the implementation here uses version, which is either core.getInput("node-version") (any supported version) or whatever was pulled from the node-version-file. This could be a major version, but equally could be a minor or patch version, a range, or something like latest or lts/*. For example any of the following could come from the file:

describe('getNodeVersionFromFile', () => {
each`
contents | expected
${'12'} | ${'12'}
${'12.3'} | ${'12.3'}
${'12.3.4'} | ${'12.3.4'}
${'v12.3.4'} | ${'12.3.4'}
${'lts/erbium'} | ${'lts/erbium'}
${'lts/*'} | ${'lts/*'}
${'nodejs 12.3.4'} | ${'12.3.4'}
${'ruby 2.3.4\nnodejs 12.3.4\npython 3.4.5'} | ${'12.3.4'}
${''} | ${''}
${'unknown format'} | ${'unknown format'}
${' 14.1.0 '} | ${'14.1.0'}
${'{"volta": {"node": ">=14.0.0 <=17.0.0"}}'}| ${'>=14.0.0 <=17.0.0'}
${'{"volta": {"extends": "./package.json"}}'}| ${'18.0.0'}
${'{"engines": {"node": "17.0.0"}}'} | ${'17.0.0'}
${'{}'} | ${null}
`.it('parses "$contents"', ({contents, expected}) => {

I think this should be using the resolved Node version, i.e. what's used as outputs.node-version, and taking the major version from it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

2 more reviewers

@Lmillan123 Lmillan123 Lmillan123 approved these changes

@Mohamezezo Mohamezezo Mohamezezo approved these changes

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Include Node.js version in cache key

AltStyle によって変換されたページ (->オリジナル) /