Uh oh!
There was an error while loading. Please reload this page.
Improve Node.js caching using package-lock.json - #409
Merged
Conversation
This reverts commit 5af05ca.
This PR updates the caching strategy for Node.js dependencies to base the cache key on the contents of `package-lock.json`, rather than the `node` or `node_modules` directories. ### Problem Currently, caching is ineffective because: * The cache key relies on `node` and `node_modules` directories. * These directories are not checked into the repository and therefore don’t exist when the cache is computed. ### Solution Update the cache key to use the contents of `package-lock.json`, which is a reliable representation of the dependency tree: * If `package-lock.json` **is not committed**, the cache behavior remains unchanged. * If it **is committed**, caching will function as expected, restoring and saving dependencies based on lockfile changes. ### Additional Changes * Commit `package-lock.json` in the `logging-parent` repository to evaluate the effectiveness of this approach. * Reverts the use of `npm-shrinkwrap.json` introduced in #367.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR improves the Node.js caching strategy by basing the cache key on the contents of package-lock.json instead of transient directories. Key changes include:
- Updating the changelog to reflect the new caching approach.
- Adjusting pom.xml by replacing version properties and removing an outdated npm install configuration.
- Revising the GitHub Actions workflow to restore the cache using the hash of package-lock.json and adding a step to save the Node.js cache.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/changelog/.12.x.x/improve-nodejs-cache.xml | Updated changelog with a new issue id and description to document the caching improvement. |
| pom.xml | Modified version properties and removed deprecated npm install configuration. |
| .github/workflows/deploy-site-reusable.yaml | Updated caching steps: replacing the old key with one based on package-lock.json and adding explicit restore/save steps. |
Uh oh!
There was an error while loading. Please reload this page.
vy
approved these changes
Jun 10, 2025
ppkarwasz added a commit
that referenced
this pull request
Jun 10, 2025
The `key` parameter for the `actions/cache/save` action introduced in #409 is not evaluated due to missing expression syntax.
ppkarwasz added a commit
that referenced
this pull request
Jun 10, 2025
The `key` parameter for the `actions/cache/save` action introduced in #409 is not evaluated due to missing expression syntax.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates the caching strategy for Node.js dependencies to base the cache key on the contents of
package-lock.json, rather than thenodeornode_modulesdirectories.Problem
Currently, caching is ineffective because:
nodeandnode_modulesdirectories.Solution
Update the cache key to use the contents of
package-lock.json, which is a reliable representation of the dependency tree:package-lock.jsonis not committed, the cache behavior remains unchanged.Additional Changes
package-lock.jsonin thelogging-parentrepository to evaluate the effectiveness of this approach.npm-shrinkwrap.jsonintroduced in Lock Antora dependencies #367.