question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pass additional restore-keys to cache action

See original GitHub issue

As can be seen in their examples: https://github.com/actions/cache/blob/main/examples.md#java---gradle

It is recommended that additional restore-keys are passed when using actions/cache. https://github.com/actions/cache#inputs

https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key

https://github.com/actions/setup-java/blob/5b36705a13905facb447b6812d613a06a07e371d/src/cache.ts#L100 could be changed to something like:

const restoreKey = `${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${packageManager.id}`;
const matchedKey = await cache.restoreCache(packageManager.path, primaryKey, [restoreKey]); 

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
dsamecommented, Aug 22, 2022

The feature request is declined because the requested functionality exist in the other action https://github.com/actions/cache

2reactions
dsamecommented, Aug 22, 2022

What I’m proposing on #367 is a solution that works both ways. Having a customisable cache key prefix gives it enough flexibility to be used in many different setups.

Built-in cache is not intended to be flexible, it is intended to work out of box in the most cases. For the specific complex caching that requires flexibility and customisation there’s https://github.com/actions/cache action

Read more comments on GitHub >

github_iconTop Results From Across the Web

Caching dependencies to speed up workflows - GitHub Docs
You can create multiple restore keys ordered from the most specific to least specific. The cache action searches the restore-keys in sequential order....
Read more >
How do I cache steps in GitHub actions? - Stack Overflow
It is useful to prefix keys and restore keys with the OS and name of the cache, as it shouldn't load files for...
Read more >
How to cache node_modules in GitHub Actions with Yarn
I just want to add a little note to this. According to the cache action docs, caching node_modules is not recommended.
Read more >
Working with file caching - Amazon CodeCatalyst
Cache key names must be unique within your workflow. Each action can have up to five entries in FileCaching . Path. Specify the...
Read more >
Caching Dependencies on GitHub Workflows - Rupesh Tiwari
When a cache miss occurs, the action searches for alternate keys called restore-keys . Creating Workflow with Cache ActionPermalink. Let's ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found