-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Use restore-key to find cache, when exact match is not available #627
Comments
Hello @MatthijsBurgh. Could you please rename the issue because it is not a bug but a feature request. |
Done |
Hello @MatthijsBurgh, The experience with |
@dsame Thanks. I will take this into account. I will keep you updated about I will do next. |
It might be worth changing the cache key to include an indication of which files are being hashed. We have internal repos where we use setup-node with different paths passed to "cache-dependency-path" and adding the restore key as implemented in #628 might load a previous cache for a different set of dependencies, i.e. as useful as not having restore-keys at all. |
@ramblingenzyme When these are different actions, it uses different caches. I don't see a very straight forward solution to your problem. As the action supports more than just a single file path: description: 'Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.' So if you have any idea to solve this robustly. Please let me know. Otherwise going for the solution of manual enabling this as mentioned by @dsame would not affect your situation for worse. |
@ramblingenzyme i advise you to solve your problem with the https://github.com/actions/cache action that can be turned for your specific case. Will this suggestion work for you? |
@ramblingenzyme @MatthijsBurgh i am going to close this issue due to inactivity, but please feel free to reopen it on create new one in case if the problem still exists |
@dsame I still have the PR open. I will probably work on it during the Christmas break. |
Description:
Similar to #410 and #441, but these are closed without any result.
Cache is correctly stored in the
Post Setup Node
, but not hit in the next run.I think this is a combined bug report and feature request. As I checked the code in this action and it just checks cache with one primary key. Maybe additional
restore-keys
can be provided. This is available in the JS API.Maybe
node-cache-${platform}-${packageManager}-
is a good restore-key, which would solve the missing hit with an updated lockfile. This would match the example from the actions/cache docsAction version:
v3
Platform:
Runner type:
Tools version:
node 14 & 16, yarn
Repro steps:
public repo: https://github.com/nklayman/vue-cli-plugin-electron-builder
Expected behavior:
When lockfile is updated, it should hit the most recent cache in that branch scope.
Actual behavior:
When lockfile is updated, it doesn't hit any cache.
Updated lockfile, no cache hit: https://github.com/nklayman/vue-cli-plugin-electron-builder/actions/runs/3481884289
Same lockfile, cache hit: https://github.com/nklayman/vue-cli-plugin-electron-builder/actions/runs/3487432460
The text was updated successfully, but these errors were encountered: