Add lookup-only option#1041
Conversation
| const enableCrossOsArchive = utils.getInputAsBool( | ||
| Inputs.EnableCrossOsArchive | ||
| ); | ||
| const dryRun = utils.getInputAsBool(Inputs.DryRun); |
There was a problem hiding this comment.
Did you try running a sample workflow of this version of action with cache action?
As cache action doesn't have this input and only restore action has, I'm curious if it throws any warning with this implementation?
There was a problem hiding this comment.
Not sure I understand your question correctly.
The dry-run input is defined for both the normal cache and also the cache/restore action with default: 'false'.
I'm curious if it throws any warning with this implementation?
Even if it wouldn't be defined, the code shouldn't throw an error. utils.getInputAsBool uses core.getInput under the hood which returns an empty string for undefined variables. The result would thus still be false.
cache/src/utils/actionUtils.ts
Lines 55 to 60 in 22cbf49
There was a problem hiding this comment.
Pushed a small update for the readmes to reflect the changes in action.yml.
There was a problem hiding this comment.
Got it, I was under assumption that this input is only for the restore action.
Which brings me to my next question, how is the behaviour in case of the cache action?
Usually the cache action saves cache in the post step when cache-hit output is set to false. Wouldn't unnecessary caches be saved when dry-run:true and no cache is found?
There was a problem hiding this comment.
Which brings me to my next question, how is the behaviour in case of the
cacheaction?
Usually thecacheaction saves cache in the post step whencache-hitoutput is set tofalse. Wouldn't unnecessary caches be saved whendry-run:trueand no cache is found?
I don't think so. The main use case I have in mind for it would depend on saving the cache afterwards. dry-run: 'true' is meant to speed up the case where the cache would be created from scratch anyway. If no exact cache is found, it still needs to be created and stored after that to be able to use it for the next run.
This works best, if restore-keys is left empty as downloading those would be skipped as well. However, it can still be archived by stacking the cache/restore (with dry-run: 'true') and normal cache (with restore-keys) action. The first would be there to filter out exact matches, while the following steps would only run if cache-hit is false.
There was a problem hiding this comment.
Can we name it better such that the name suits both
actions/cacheandactions/cache/restoreaction?
Sure, dry-run was just the first name that came to mind but I can see how it can be confusing.
What do you think of skip-download?
I also though about restore-dry-run or skip-restore but those don't capture the essence of this option or can be misleading as well. I'm open to other suggestions though.
There was a problem hiding this comment.
skip-download won't make sense for the restore action right? skip-download sounds more like save-only.
restore-dry-run is still close. My suggestion would be to use something like check-key (although not quite sure what the perfect name here could be), @bishal-pdMSFT do suggest us something that you feel would be good here.
There was a problem hiding this comment.
skip-downloadwon't make sense for therestoreaction right?
I'd disagree. Skipping the download is what's happing internally, regardless of cache or restore action. It's also the term I used naturally to describe the parameter in the readme. That's why I thought it might be a good fit.
My suggestion would be to use something like
check-key
Just thinking about it, I could imagine that users could be confused by that, especially if the default is false. Is the key not checked unless it's set to true?
There was a problem hiding this comment.
skip-downloadwon't make sense for therestoreaction right?
My reason of saying the same was - downloading is the main job of the restore action and the restore step in the cache action. For cache action, the name skip-download is still fine, but for restore action, if restore (download) itself is not happening then I see a chance of confusion for the users thinking what it would even do if not download the cache itself. 😕 Hence I was tilting more towards something that tell check-key(-but-dont-download)
Few more suggestions from my end...
How about going in the direction of peek like we use in stacks, just see but don't do anything.
Examples:
peek-key / peek-cache
or
lookup / lookup-only
or
spy
Is the key not checked unless it's set to true?
True, it will create a confusion. 😅
There was a problem hiding this comment.
For
cacheaction, the nameskip-downloadis still fine, but forrestoreaction, if restore (download) itself is not happening then I see a chance of confusion for the users thinking what it would even do if not download the cache itself.
Just a thought, would it be enough to expose the option only for cache? On the one hand it would address the main use case, on the other there is some value in exposing the option for all actions.
Hence I was tilting more towards something that tell
check-key(-but-dont-download)
lookup-only sounds like it could fit. It would make sense in the docs as well. Something like
* `lookup-only` - Skip downloading cache. Only check if cache entry exists. Default: false|
Hi @cdce8p, 👋🏽 We had an internal discussion within our team and we felt like this feature might affect the extensibility of the code and feel that having a new action for the same (something like For now we have added the work needed for this new action in our backlog and we will pick this up in the future. In the meantime, if you would want to contribute for the same, you are welcome to do so. :) Thanks for your contribution, we really appreciate your efforts here. ❤️ We can go ahead with the other PR of yours. I have requested a small test case addition in the same. |
|
Hi @kotewar, thanks for the update. After the other PR was done, I took some time today to think about this one some more. I can understand your point about maintenance. So I did implement a separate new Furthermore, it's worth to consider the main use case again and what from the user perspective might be a good solution. Use case This would probably look something like this. Note that it's basically necessary to duplicate all inputs from the initial build:
steps:
- uses: actions/checkout@v3
- - users: actions/cache@v3
+ - users: actions/cache/check@v3
id: cache-check
with:
path: path/to/dependencies
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Build
if: steps.cache-check.outputs.cache-hit != 'true'
run: /build.sh
+ - uses: actions/cache/save@v3
+ if: steps.cache-check.outputs.cache-hit != 'true'
+ with:
+ path: path/to/dependencies
+ key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
test:
...How would that be different to the input parameter? As the build:
steps:
- uses: actions/checkout@v3
- users: actions/cache@v3
id: cache-check
with:
+ lookup-only: true
path: path/to/dependencies
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Build
if: steps.cache-check.outputs.cache-hit != 'true'
run: /build.sh
test:
...Conclusion To make it easier to compare both, I've rebased this PR as well. In any case, both approaches depend on some ground work: actions/toolkit#1286 -- |
|
@cdce8p, Did I understand it correctly? And talking of the extensibility, if we feel this could be breaking in the future, we might have to remove it and do a major release instead with a different set of inputs. |
Yes, exactly.
From what I've seen the use case outline above is the only one I've seen (so far). If someone really wants some other options, I feel doing something like #1095 in the future, in addition to the As for the idea to use an environment variable. I'm not sure this would be a good user experience.
Thanks for keeping me in the loop here and valuing my opinion! Appreciate that ❤️ |
|
@kotewar Just wanted to check, are there any updates? It would be awesome if we could get this over the finish line soon. Especially as not much work is left. Please let me know if I can help in any way. |
|
Sorry, I was looking into another issues and forgot about this one. Update - released the toolkit. |
|
Hi @cdce8p, I was testing the action, and found that the log says cache restored, I think that gives wrong info to the user as in the earlier logs we say skipping download I was thinking it will better if we print something else or don't print the restored log when its a |
| default: 'false' | ||
| required: false | ||
| lookup-only: | ||
| description: 'Skip downloading cache. Only check if cache entry exists' |
There was a problem hiding this comment.
Does it check for exact match only? If so, then restore-keys will be ignored. May be we should call that out here.
There was a problem hiding this comment.
restore-keys won't be ignored, we can update the description to something like
description: 'Check if a cache entry exists for the given input(s) (key, restore-keys) without downloading the cache'There was a problem hiding this comment.
The output cache-hit will be false in that case.
There was a problem hiding this comment.
What's the purpose of accepting the restore-keys argument if we only set cache-hit to true when an exact match is found? Or do we return the matched key as well just like the restore action? If I understand correctly there is currently no difference in output between no exact match but a partial match.
There was a problem hiding this comment.
If I understand correctly there is currently no difference in output between no exact match but a partial match.
Not quite. cache-hit will be true for exact matches. Think of it like this: When adding lookup-only the action behaves just the same (incl. the outputs) as without the argument. The only difference being that the cache entry isn't actually downloaded and extracted.
There was a problem hiding this comment.
I see. Normally there is a purpose of using the restore-keys because you are actually restoring something, but cache-hit will still be false. So from the view of the action there is still a cache miss. With this option there are no side effects when a match has occurred on one of the restore-keys.
While writing this I'm wondering: did I always misinterpret the note on cache-hit and does it also return true when an exact hit has been found on one of the restore-keys but just not on a partial match on the restore-keys?
There was a problem hiding this comment.
While writing this I'm wondering: did I always misinterpret the note on
cache-hitand does it also returntruewhen an exact hit has been found on one of therestore-keysbut just not on a partial match on therestore-keys?
cache-hit will only be true for an exact match on the primary key.
Lines 67 to 72 in 940f3d7
That doesn't mean though there aren't no side effects now with lookup-only: true if the key doesn't match. cache-matched-key is still set.
Lines 64 to 65 in 940f3d7
--
In practice, I suspect the option will most likely only be used to check for an exact key (i.e. without restore-keys) but there might be other use cases I haven't though about yet which could use it. In any way as explained here #1041 (comment) the current implementation is not only simpler then a dedicated check action #1095 (which would have provided the option to remove the input) but also provides a better UX.
There was a problem hiding this comment.
Thank you. If that's always the case, then cache-matched-key should be mentioned as an output of the main action. Currently the only documented output is cache-hit. Therefore I assumed there were no side-effects in that case. Or this option should only be available in the restore action where this output is actually documented.
-- In practice, I suspect the option will most likely only be used to check for an exact key (i.e. without
restore-keys) but there might be other use cases I haven't though about yet which could use it. In any way as explained here #1041 (comment) the current implementation is not only simpler then a dedicatedcheckaction #1095 (which would have provided the option to remove the input) but also provides a better UX.
I currently have a usecase where I cache all images in a matrix, and use them in another different matrix later on. In the setup I assume that if one file is successfully cached, all files (with the same prefix) are successfully cached. If this assumption is incorrect the matrix workflow will still succeed but less efficient (however it is unlikely that it would ever happen). It would be a waste to spin up the entire caching matrix just to check each key for a match. During the matrix workflow, each job uses only one file so there is no need to cache them into one key.
But in this case I can check for a match on one particular key instead and it will still have the same result.
There was a problem hiding this comment.
I agree, cache-matched-key (and even cache-primary-key like we have in restore action) will be helpful in the main action's output. We can plan to add it. In case anyone wants to contribute for the same, please feel free to do so. 😄
| expect(failedMock).toHaveBeenCalledTimes(0); | ||
| }); | ||
|
|
||
| test("restore with lookup-only set", async () => { |
There was a problem hiding this comment.
Should this test be moved to restoreImpl.tests.ts as it is a common functionality?
There was a problem hiding this comment.
Happy to do so but I think restore.test.ts does fit. The way I understand it is that restoreImpl.test.ts include all tests directly related to the cache restore, e.g. what happens if a key is found / want when it isn't, the path matches / doesn't match. In contrast restore.test.ts tests additional functionality, like failOnCacheMiss or now lookupOnly.
There was a problem hiding this comment.
Can we instead a new test in restoreImpl.tests.ts to test the behaviour when lookupOnly is set to true? I think that way both files will cover their respective code.
There was a problem hiding this comment.
Hope I understood you correctly. As the test already checked the behavior of lookupOnly: true, I moved it to restoreImpl.test.ts. Please let me know if you had something else in mind.
lookupOnly: false is implicitly tested in every other test case as this is the default behavior.
There was a problem hiding this comment.
The only thing I had in mind was to check for the behavior of lookupOnly: true in the restoreImpl tests, than the wrapper code. I think what you've done looks fine as restoreImpl.test.ts was missing a lookupOnly: true case which it has now. :)
I do believe it's useful to know which cache would have been restored. Updated the log statement. |
|
Hey @cdce8p 👋🏽 Thanks a lot of your contribution and apologies for the delay in reviewing. I've released the new version v3.3.0 to marketplace and also tagged Thanks again for your great work, we appreciate it. 😊 ❤️ |
|
Thanks @kotewar ❤️ |
[](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/cache](https://togithub.com/actions/cache) | action | minor | `v3.2.4` -> `v3.3.0` | | [github/codeql-action](https://togithub.com/github/codeql-action) | action | patch | `v2.2.3` -> `v2.2.5` | | [trunk-io/trunk-action](https://togithub.com/trunk-io/trunk-action) | action | patch | `v1.0.6` -> `v1.0.7` | --- ### Release Notes <details> <summary>actions/cache</summary> ### [`v3.3.0`](https://togithub.com/actions/cache/releases/tag/v3.3.0) [Compare Source](https://togithub.com/actions/cache/compare/v3.2.6...v3.3.0) #### What's Changed - Bug: Permission is missing in cache delete example by [@​kotokaze](https://togithub.com/kotokaze) in [https://github.com/actions/cache/pull/1123](https://togithub.com/actions/cache/pull/1123) - Add `lookup-only` option by [@​cdce8p](https://togithub.com/cdce8p) in [https://github.com/actions/cache/pull/1041](https://togithub.com/actions/cache/pull/1041) #### New Contributors - [@​kotokaze](https://togithub.com/kotokaze) made their first contribution in [https://github.com/actions/cache/pull/1123](https://togithub.com/actions/cache/pull/1123) **Full Changelog**: actions/cache@v3...v3.3.0 ### [`v3.2.6`](https://togithub.com/actions/cache/releases/tag/v3.2.6) [Compare Source](https://togithub.com/actions/cache/compare/v3.2.5...v3.2.6) ##### What's Changed - Updated branch in Force deletion of caches by [@​t-dedah](https://togithub.com/t-dedah) in [https://github.com/actions/cache/pull/1108](https://togithub.com/actions/cache/pull/1108) - Fix zstd not being used after zstd version upgrade to 1.5.4 on hosted runners by [@​pdotl](https://togithub.com/pdotl) in [https://github.com/actions/cache/pull/1118](https://togithub.com/actions/cache/pull/1118) **Full Changelog**: actions/cache@v3...v3.2.6 ### [`v3.2.5`](https://togithub.com/actions/cache/releases/tag/v3.2.5) [Compare Source](https://togithub.com/actions/cache/compare/v3.2.4...v3.2.5) ##### What's Changed - Rewrite readmes by [@​jsoref](https://togithub.com/jsoref) in [https://github.com/actions/cache/pull/1085](https://togithub.com/actions/cache/pull/1085) - Fixed typos and formatting in docs by [@​kotewar](https://togithub.com/kotewar) in [https://github.com/actions/cache/pull/1076](https://togithub.com/actions/cache/pull/1076) - Fixing paths for OSes by [@​kotewar](https://togithub.com/kotewar) in [https://github.com/actions/cache/pull/1101](https://togithub.com/actions/cache/pull/1101) - Release patch version update by [@​Phantsure](https://togithub.com/Phantsure) in [https://github.com/actions/cache/pull/1105](https://togithub.com/actions/cache/pull/1105) ##### New Contributors - [@​jsoref](https://togithub.com/jsoref) made their first contribution in [https://github.com/actions/cache/pull/1085](https://togithub.com/actions/cache/pull/1085) **Full Changelog**: actions/cache@v3...v3.2.5 </details> <details> <summary>github/codeql-action</summary> ### [`v2.2.5`](https://togithub.com/github/codeql-action/compare/v2.2.4...v2.2.5) [Compare Source](https://togithub.com/github/codeql-action/compare/v2.2.4...v2.2.5) ### [`v2.2.4`](https://togithub.com/github/codeql-action/compare/v2.2.3...v2.2.4) [Compare Source](https://togithub.com/github/codeql-action/compare/v2.2.3...v2.2.4) </details> <details> <summary>trunk-io/trunk-action</summary> ### [`v1.0.7`](https://togithub.com/trunk-io/trunk-action/releases/tag/v1.0.7) [Compare Source](https://togithub.com/trunk-io/trunk-action/compare/v1.0.6...v1.0.7) Introduce a caching-only mode, controlled via `check-mode: populate_cache_only`. </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/trunk-io/plugins). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xNTkuMiIsInVwZGF0ZWRJblZlciI6IjM0LjE1OS4yIn0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/cache](https://togithub.com/actions/cache) | action | minor | `v3.2.5` -> `v3.3.2` | --- ### Release Notes <details> <summary>actions/cache (actions/cache)</summary> ### [`v3.3.2`](https://togithub.com/actions/cache/releases/tag/v3.3.2) [Compare Source](https://togithub.com/actions/cache/compare/v3.3.1...v3.3.2) ##### What's Changed - Fixed readme with new segment timeout values by [@​kotewar](https://togithub.com/kotewar) in [https://github.com/actions/cache/pull/1133](https://togithub.com/actions/cache/pull/1133) - Readme fixes by [@​kotewar](https://togithub.com/kotewar) in [https://github.com/actions/cache/pull/1134](https://togithub.com/actions/cache/pull/1134) - Updated description of the lookup-only input for main action by [@​kotewar](https://togithub.com/kotewar) in [https://github.com/actions/cache/pull/1130](https://togithub.com/actions/cache/pull/1130) - Change two new actions mention as quoted text by [@​bishal-pdMSFT](https://togithub.com/bishal-pdMSFT) in [https://github.com/actions/cache/pull/1131](https://togithub.com/actions/cache/pull/1131) - Update Cross-OS Caching tips by [@​pdotl](https://togithub.com/pdotl) in [https://github.com/actions/cache/pull/1122](https://togithub.com/actions/cache/pull/1122) - Bazel example (Take [#​2](https://togithub.com/actions/cache/issues/2)️⃣) by [@​vorburger](https://togithub.com/vorburger) in [https://github.com/actions/cache/pull/1132](https://togithub.com/actions/cache/pull/1132) - Remove actions to add new PRs and issues to a project board by [@​jorendorff](https://togithub.com/jorendorff) in [https://github.com/actions/cache/pull/1187](https://togithub.com/actions/cache/pull/1187) - Consume latest toolkit and fix dangling promise bug by [@​chkimes](https://togithub.com/chkimes) in [https://github.com/actions/cache/pull/1217](https://togithub.com/actions/cache/pull/1217) - Bump action version to 3.3.2 by [@​bethanyj28](https://togithub.com/bethanyj28) in [https://github.com/actions/cache/pull/1236](https://togithub.com/actions/cache/pull/1236) ##### New Contributors - [@​vorburger](https://togithub.com/vorburger) made their first contribution in [https://github.com/actions/cache/pull/1132](https://togithub.com/actions/cache/pull/1132) - [@​jorendorff](https://togithub.com/jorendorff) made their first contribution in [https://github.com/actions/cache/pull/1187](https://togithub.com/actions/cache/pull/1187) - [@​chkimes](https://togithub.com/chkimes) made their first contribution in [https://github.com/actions/cache/pull/1217](https://togithub.com/actions/cache/pull/1217) - [@​bethanyj28](https://togithub.com/bethanyj28) made their first contribution in [https://github.com/actions/cache/pull/1236](https://togithub.com/actions/cache/pull/1236) **Full Changelog**: actions/cache@v3...v3.3.2 ### [`v3.3.1`](https://togithub.com/actions/cache/releases/tag/v3.3.1) [Compare Source](https://togithub.com/actions/cache/compare/v3.3.0...v3.3.1) ##### What's Changed - Reduced download segment size to 128 MB and timeout to 10 minutes by [@​kotewar](https://togithub.com/kotewar) in [https://github.com/actions/cache/pull/1129](https://togithub.com/actions/cache/pull/1129) **Full Changelog**: actions/cache@v3...v3.3.1 ### [`v3.3.0`](https://togithub.com/actions/cache/releases/tag/v3.3.0) [Compare Source](https://togithub.com/actions/cache/compare/v3.2.6...v3.3.0) ##### What's Changed - Bug: Permission is missing in cache delete example by [@​kotokaze](https://togithub.com/kotokaze) in [https://github.com/actions/cache/pull/1123](https://togithub.com/actions/cache/pull/1123) - Add `lookup-only` option by [@​cdce8p](https://togithub.com/cdce8p) in [https://github.com/actions/cache/pull/1041](https://togithub.com/actions/cache/pull/1041) ##### New Contributors - [@​kotokaze](https://togithub.com/kotokaze) made their first contribution in [https://github.com/actions/cache/pull/1123](https://togithub.com/actions/cache/pull/1123) **Full Changelog**: actions/cache@v3...v3.3.0 ### [`v3.2.6`](https://togithub.com/actions/cache/releases/tag/v3.2.6) [Compare Source](https://togithub.com/actions/cache/compare/v3.2.5...v3.2.6) ##### What's Changed - Updated branch in Force deletion of caches by [@​t-dedah](https://togithub.com/t-dedah) in [https://github.com/actions/cache/pull/1108](https://togithub.com/actions/cache/pull/1108) - Fix zstd not being used after zstd version upgrade to 1.5.4 on hosted runners by [@​pdotl](https://togithub.com/pdotl) in [https://github.com/actions/cache/pull/1118](https://togithub.com/actions/cache/pull/1118) **Full Changelog**: actions/cache@v3...v3.2.6 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/Hapag-Lloyd/terraform-aws-bastion-host-ssm). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy41OS44IiwidXBkYXRlZEluVmVyIjoiMzcuNTkuOCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* Add new actions/cache version (with dryRun support) * Add dry-run option * Changes after rebase * Update readme * Rename option to lookup-only * Update test name * Update package.json + changelog * Update README * Update custom package version * Update custom package version * Update @actions/cache to 3.2.0 * Code review * Update log statement * Move test case --------- Co-authored-by: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com>
…ncy (#1) * 3.2.6 * Bump @actions/cache version * Update package-lock.json * Fix zstd breaking after new version release * Fix license * Update Cross-OS Caching tips * docs: Add missing permission in cache delete example (actions#1123) * Add `lookup-only` option (actions#1041) * Add new actions/cache version (with dryRun support) * Add dry-run option * Changes after rebase * Update readme * Rename option to lookup-only * Update test name * Update package.json + changelog * Update README * Update custom package version * Update custom package version * Update @actions/cache to 3.2.0 * Code review * Update log statement * Move test case --------- Co-authored-by: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> * Change two new actions mention as quoted text * Add example for Bazel * Fix example for Bazel * Reduced download segment size to 128 MB and timeout to 10 minutes (actions#1129) * Changed segment size to 128mb & timeout to 10 min * Updated license * Updated licenses * Fixed readme with new segment timeout values (actions#1133) * Readme fixes (actions#1134) * Update README.md * Update README.md * Create separate Linux/macOS examples for Bazel * Updated description of the lookup-only input for main action (actions#1130) * Updated description of the lookup-only input for main action * Update README.md Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Update README.md --------- Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Clarify that macos-latest image has bazelisk * Remove actions to add new PRs and issues to a project board The project doesn't seem to exist, so this always fails. * Consume latest toolkit and fix dangling promise bug (actions#1217) * Consume latest toolkit and fix dangling promise bug * Pass earlyExit parameter to run method so tests don't hang * Pass earlyExit parameter to run method so tests don't hang * Refactor restore files to have better patterns for testing * style * bump action version to 3.3.2 * Add to RELEASES.md * added save-always input * Update action.yml Co-authored-by: Tomasz Janiszewski <janiszt@gmail.com> * Revert "Update action.yml" This reverts commit 3b7dac1. * Update action to node20 * Update check-dist node version * Rebuild dist * Update license * replace deprecated @zeit/ncc with @vercel/ncc * Bump version * Update "only-" actions to node20 * Apply workaround for earlyExit * Fix format * cache v3.3.3 * licensed * Fix dist * Update README.md * Update examples * update documentation to use <action>@v4 * add release action * update @actions/cache * licensed cache * Fix fail-on-cache-miss not working * Bump version * Add test case for process exit Co-authored-by: Bethany <bethanyj28@users.noreply.github.com> * Update README.md and use v4 of checkout action (actions#1437) Update examples to use latest available checkout action v4. * Explicit use bash for Windows (actions#1377) Co-authored-by: Josh Gross <joshmgross@github.com> * Fix cache-hit output when cache missed (actions#1404) * fix: cache-hit output * fix: Output chache hit timing * fix: Output chache hit timing --------- Co-authored-by: Josh Gross <joshmgross@github.com> * Clarify that the `restore-keys` input is a string in the docs (actions#1434) * Fix Description for restore-keys at Readme As previously the restore-keys were defined as an ordered lists which is wrong as per the issue description where the actual format is a multi-line string with one key per line. * Added a space between the sentence of restore-keys description While at the PR review it's been identified there's a need for a space between the sentence ``` An ordered multiline string listing the prefix-matched keys,that are used for restoring stale cache if no cache hit occurred for key. ``` where it's written as "prefix-matched keys,that are" this commit will address the review comment and introduce a space between "prefix-matched keys, that are" and change the sentence to ``` An ordered multiline string listing the prefix-matched keys, that are used for restoring stale cache if no cache hit occurred for key. ``` * Change restore-keys description at cache/restore/action.yml and cache/action.yml * Add workflow file for publishing releases to immutable action package This workflow file publishes new action releases to the immutable action package of the same name as this repo. This is part of the Immutable Actions project which is not yet fully released to the public. First party actions like this one are part of our initial testing of this feature. * Deprecate `save-always` input (actions#1452) The `save-always` input added in v4 is not working as intended due to `post-if` expressions not supporting the input context. To avoid breaking users who have already added this input to their workflows, it is being deprecated now and will be removed in the next major version (v5). See actions#1315 for more details. * Fix typo: depening -> depending (actions#1462) Co-authored-by: Josh Gross <joshmgross@github.com> * restore action's README now references v4 instead of v3 (actions#1445) Co-authored-by: Josh Gross <joshmgross@github.com> * Prepare `4.1.0` release (actions#1464) * Restore original behavior of `cache-hit` output (actions#1467) * Restore original behavior of `cache-hit` output * Bump version to 4.1.1 * Add Bun example (actions#1456) * Add Bun example * Fix Bun Windows example * Revise `isGhes` logic * ran `npm run build` * appease the linter * added unit tests * Bump braces from 3.0.2 to 3.0.3 Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3. - [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md) - [Commits](micromatch/braces@3.0.2...3.0.3) --- updated-dependencies: - dependency-name: braces dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * Create dependabot.yml * Prepare release 4.1.2 * Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump actions/stale from 3 to 9 Bumps [actions/stale](https://github.com/actions/stale) from 3 to 9. - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](actions/stale@v3...v9) --- updated-dependencies: - dependency-name: actions/stale dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump actions/setup-node from 3 to 4 Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3 to 4. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](actions/setup-node@v3...v4) --- updated-dependencies: - dependency-name: actions/setup-node dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump github/codeql-action from 2 to 3 Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@v2...v3) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Upgrade @actions/cache to 4.0.0 * Update RELEASES.md * Upgrade @vercel/ncc to 0.38.3 * Upgrade @actions/core to 1.11.1 and other deps * Add licensed output * Add reviewed licensed packages * Add lodash to list of reviewed licenses * Add licensed output * Rerun CI * Add 3.4.0 release notes * Correct GitHub Spelling in caching-strategies.md (actions#1526) GitHub was spelled incorrectly 3 lines under the Understanding how to choose path section * docs: Make the "always save prime numbers" example more clear (actions#1525) * Update force deletion docs due a recent deprecation (actions#1500) * fix: update force deletion docs due a recent deprecation * fix: applied josh's suggestions --------- Co-authored-by: Josh Gross <joshmgross@github.com> * bump @actions/cache to v4.0.1 * Update publish-immutable-actions.yml * bump @actions/cache to v4.0.2, prep for v4.2.2 release * add changes * changed * mask whole url * debugging * type * artifact changes * update cache package to mask whole sas to the end of the line * mask * update * latest test before pr * updated cache with latest changes * updates * new package * update cache with main * Update to use the latest version of the cache package to obfuscate the SAS * Update releases.md * Update README.md * update to node24 * update licences * @protobuf-ts/plugin to dev dependencies * Add licensed output * Add licensed output * Update the licensed workflow to use the latest version * Fix the workflow to use licensed from source * Fix bundle exec * Fix with another approach * Prepare release 4.2.4 * Add note on runner versions * license and compiled * Approve license * Upgrade actions/cache to 4.1.0 and prepare 4.3.0 release * Update licensed cache * Update cache to use local cache package and Node 24 support - Use local cache package with file:../packages/cache instead of published version - Update all action.yml files to use node24 runtime - Update dependencies to support Node 24 (@types/node@24.1.0) - Rebuild dist files with local cache package - Add engines field requiring node >=24 * Build dist files for Node 24 * chore: rebuild dist with local @actions/cache (core v2, exec v2) * chore: use local @actions/core, exec, io packages * Build with @actions/cache v5.0.0 * Use published @actions/core, exec, io v2.0.0 * chore: rebuild with @actions/cache v5.0.0 Uses updated cache package that removes @azure/ms-rest-js dependency to fix Node 24 punycode deprecation warning. * Update with core 2.0.1 which has exec 2.0.0 * chore: update @actions/core to 2.0.1 * Latest dist with core changes * Extra dist change * chore: use published @actions/cache v5.0.0 * chore: update license cache for @actions/cache v5.0.0 * chore: rebuild dist with @actions/cache v5.0.0 * chore: update actions/checkout to v5 in workflow files * chore: bump version to 5.0.0 for Node.js 24 support * docs: update README with v5 release notes * Revert "docs: update README with v5 release notes" This reverts commit fe92eaf. * chore: revert README to main branch state * chore: set version to 4.3.0 for prepare release PR * chore: rebuild dist with version 4.3.0 * chore: regenerate package-lock.json * undo readme changes * Prepare v5.0.0 release - Bump package version to 5.0.0 - Add v5.0.0 release notes (Node.js 24 runtime + runner requirement) * docs: update README for v5 release with Node 24 and runner version requirements * readme note * docs: highlight v5 runner requirement in releases * fix: update @actions/cache with storage-blob fix for Node.js 24 punycode deprecation * peer * fix: update @actions/cache to ^5.0.1 for Node.js 24 punycode fix Updates @actions/cache to version 5.0.1 which includes the @azure/storage-blob update that fixes the punycode deprecation warning on Node.js 24. * fix: update license files for @actions/cache, fast-xml-parser, and strnum * fix: add peer property to package-lock.json for dependencies * chore: release v5.0.1 - Bump version to 5.0.1 - Fix Node.js 24 punycode deprecation warning via @actions/cache@5.0.1 - Updates @azure/storage-blob to ^12.29.1 Related: actions#1685 * docs: Update examples to cache@v5 * docs: Update other actions in examples to the latest version * Bump actions/cache to 5.0.3 * Add PR link to releases * Build * Update licensed record for cache * license for httpclient * Add 5.0.3 builds * Upgrade dependencies and address security warnings - Bump `@actions/cache` to v5.0.5 - Bump `@actions/core` to v2.0.3 * Add licensed output * Add review for the @actions/http-client license * Update contribution docs * Add note * Potential fix for code scanning alert no. 52: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Fix permissions for workflows/workflow.yml * Fix workflow permissions and cleanup * Cleanup workflow file names * Update .github/workflows/pr-opened-workflow.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Rewrite and simplify * Add wait for proxy * Fix resolution * Add traffic sanity check step * Fix cache key in examples.md for bun.lock Updated cache key to use 'bun.lock' instead of 'bun.lockb' for consistency. * Update dependencies & patch security vulnerabilities * Add licenses * Update RELEASES * Update ts-http-runtime to 0.3.5 * npm run build generated dist files * licensed changes --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Lovepreet Singh <pdotl@github.com> Co-authored-by: Kotokaze <62094392+kotokaze@users.noreply.github.com> Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Co-authored-by: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> Co-authored-by: David Bernard <davidB@users.noreply.github.com> Co-authored-by: Michael Vorburger <vorburger@google.com> Co-authored-by: Michael Vorburger ⛑️ <mike@vorburger.ch> Co-authored-by: Vipul <vsvipul@github.com> Co-authored-by: Jason Orendorff <jorendorff@github.com> Co-authored-by: Johanan Idicula <jidicula@github.com> Co-authored-by: Chad Kimes <1936066+chkimes@users.noreply.github.com> Co-authored-by: bethanyj28 <bethanyj28@github.com> Co-authored-by: Bethany <bethanyj28@users.noreply.github.com> Co-authored-by: to-s <26573402+to-s@users.noreply.github.com> Co-authored-by: Tomasz Janiszewski <janiszt@gmail.com> Co-authored-by: to-s <to-s@users.noreply.github.com> Co-authored-by: Tatyana Kostromskaya <32135588+takost@users.noreply.github.com> Co-authored-by: Rob Herley <robherley@github.com> Co-authored-by: Yang Cao <yacaovsnc@github.com> Co-authored-by: todgru <todgru@gmail.com> Co-authored-by: P. Ottlinger <ottlinger@users.noreply.github.com> Co-authored-by: Oleg A. <t0rr@mail.ru> Co-authored-by: Josh Gross <joshmgross@github.com> Co-authored-by: r4mimu <52129983+fchimpan@users.noreply.github.com> Co-authored-by: Soubhik Kumar Mitra <59209034+x612skm@users.noreply.github.com> Co-authored-by: Bassem Dghaidi <568794+Link-@users.noreply.github.com> Co-authored-by: Joel Ambass <Jcambass@users.noreply.github.com> Co-authored-by: mackey0225 <masaki.asano0225@gmail.com> Co-authored-by: Eman Resu <78693624+quatquatt@users.noreply.github.com> Co-authored-by: Jan T. Sott <git@idleberg.com> Co-authored-by: John Wesley Walker III <81404201+jww3@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: janco-absa <janco.bester@absa.africa> Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com> Co-authored-by: Alessandro Sebastiani <sebbalex@users.noreply.github.com> Co-authored-by: Salman Chishti <salmanmkc@GitHub.com> Co-authored-by: Ben De St Paer-Gotch <nebuk89@github.com> Co-authored-by: Ryan Ghadimi <114221941+GhadimiR@users.noreply.github.com> Co-authored-by: XZTDean <xztdean@gmail.com> Co-authored-by: Ryan Ghadimi <ghadimir@github.com> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ryan Peck <1244954+RyPeck@users.noreply.github.com>

Description
Add an advanced option to skip downloading the cache entry.
Motivation and Context
Fixes #901
Fixes #831
#1020 (comment)
#1020 (comment)
If dependency install / cache setup and the actual tests are split across multiple jobs, it's often unnecessary to restore the cache if an exact cache-hit occurred. Similarly, if the cache is created from scratch, it's only necessary to know if a cache entry already exists.
Using
lookup-onlyin these cases saves time and resources, especially for larger caches which don't need to be restored.How Has This Been Tested?
Added test case and run a test workflow using the feature branch.
Screenshots (if appropriate):
--
Types of changes
Checklist: