GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add cache fallback with rolling timed expiration by voxpelli · Pull Request #702 · actions/setup-node

Conversation

@voxpelli

@voxpelli voxpelli commented Feb 27, 2023

Copy link
Copy Markdown

This PR builds on #323 by @mmorel-35 but with two changes:

  1. It adds a new cache-invalidate-after-days option that defaults to 120 days and which sets a rollable prefix between 0 and 9 to all of the cache keys, making it so that a cache key will change after 120 days. Can be set to 0 to deactivate. Reason for this is that npm will not remove data by itself: the cache will grow as new packages are installed.
  2. Removes the fallback to a package manager independent cache key, only falling back to a cache from the same package manager.

This fixes #328 without creating an ever expanding cache size.

This also helps the cache be much more useful with a Dependabot / Renovatebot setup as a project that is dominated by PR:s from such sources will with the current cache setup in actions/setup-node pretty much only get cache misses and thus only ever set caches, rarely ever use them.

This adds a simple mechanism of falling back to a recent cache while avoiding the ever growing cache problem.

Feedback wanted:

  • The rolling prefix might be a premature optimization on my part. Maybe one should just leave it out)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

moltar, Nokel81, matdave, nwalters512, dallonf, voxpelli, vrezan-prenuvo, wyardley, kleinfreund, connor-baer, and gilescope reacted with thumbs up emoji
All reactions
  • 👍 11 reactions
@voxpelli
voxpelli requested a review from a team as a code owner February 27, 2023 18:27
@voxpelli
voxpelli force-pushed the cache-fallback branch from a3e058a to d2c83d8 Compare February 27, 2023 18:29
@voxpelli

voxpelli commented Feb 27, 2023

Copy link
Copy Markdown
Author

Will rebase

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@voxpelli
voxpelli force-pushed the cache-fallback branch from d2c83d8 to cbe3ec3 Compare February 27, 2023 18:36
This was referenced Feb 27, 2023
feat(cache): change key to match actions/cache documentation #323
Closed
Caching fallback if there is no exact hit #328
Open
voxpelli pushed a commit to SocketDev/workflows that referenced this pull request Feb 28, 2023
Pelle Wessman
Timed expiration of npm cache
b91a8a5
Similar to what is added in actions/setup-node#702, prevents the npm cache from growing indefinitely while still providing a general fallback
@tragiclifestories tragiclifestories mentioned this pull request Apr 21, 2023
Allow partial cache keys actions/setup-python#627
Closed
@nwalters512

nwalters512 commented Apr 26, 2023

Copy link
Copy Markdown

@voxpelli thanks for opening this! I think you'll need to run npm build/yarn build to update the files in dist/ for this to pass CI.

voxpelli reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@voxpelli

voxpelli commented Apr 28, 2023

Copy link
Copy Markdown
Author

@nwalters512 Did so now, waiting for workflow runs to be approved again :)

nwalters512 reacted with heart emoji nwalters512 reacted with rocket emoji
All reactions
  • ❤️ 1 reaction
  • 🚀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nwalters512

nwalters512 commented Jul 12, 2023

Copy link
Copy Markdown

@dmitry-shibanov any chance you could take a look at this PR? The introduction of fallback restore keys matches documented best practices and should allow the cache to be used in many more scenarios.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@voxpelli

voxpelli commented Mar 13, 2024

Copy link
Copy Markdown
Author

This has conflicts after #744 was merged, I'm on it

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@voxpelli
Cache fallback with rolling time based expiration
f01118b
@voxpelli
voxpelli force-pushed the cache-fallback branch from 6ef1113 to f01118b Compare March 13, 2024 20:15
@voxpelli

voxpelli commented Mar 13, 2024

Copy link
Copy Markdown
Author

Ping @dsame, I adapted this to the changes made in #744, does it look like its in the spirit of what you did there?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Mikhai56
Mikhai56 reviewed Mar 25, 2024
View reviewed changes

@Mikhai56 Mikhai56 left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

of

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

dallonf reacted with thumbs down emoji
All reactions
  • 👎 1 reaction
@voxpelli

voxpelli commented Jul 1, 2024

Copy link
Copy Markdown
Author

Anything I can do to help out on getting this reviewed?

wyardley reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@voxpelli voxpelli mentioned this pull request Sep 22, 2025
Limit automatic caching to npm, update workflows and documentation #1374
Merged
2 tasks done

This branch has not been deployed

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

Reviewers

1 more reviewer
@Mikhai56 Mikhai56 Mikhai56 left review comments
Reviewers whose approvals may not affect merge requirements

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

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Caching fallback if there is no exact hit

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@voxpelli @nwalters512 @Mikhai56
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.