* Add fail-on-cache-miss option
* Small improvements
* Changes after rebase
* Update description
* Only fail if no cache entry is found
* Code review
* Update readme
* Add additional test case
* Bump version + changelog
* Update package-lock.json
* Update Readme
@ -30,6 +30,7 @@ See ["Caching dependencies to speed up workflows"](https://docs.github.com/en/ac
* Allowing users to provide a custom timeout as input for aborting download of a cache segment using an environment variable `SEGMENT_DOWNLOAD_TIMEOUT_MINS`. Default is 60 minutes.
* Two new actions available for granular control over caches - [restore](restore/action.yml) and [save](save/action.yml)
* Support cross-os caching as an opt-in feature. See [Cross OS caching](./tips-and-workarounds.md#cross-os-cache) for more info.
* Added option to fail job on cache miss. See [Exit workflow on cache miss](./restore/README.md#exit-workflow-on-cache-miss) for more info.
Refer [here](https://github.com/actions/cache/blob/v2/README.md) for previous versions
@ -49,6 +50,7 @@ If you are using a `self-hosted` Windows runner, `GNU tar` and `zstd` are requir
* `key` - An explicit key for restoring and saving the cache. Refer [creating a cache key](#creating-a-cache-key).
* `restore-keys` - An ordered list of prefix-matched keys to use for restoring stale cache if no cache hit occurred for key.
* `enableCrossOsArchive` - An optional boolean when enabled, allows Windows runners to save or restore caches that can be restored or saved respectively on other platforms. Default: false
* `fail-on-cache-miss` - Fail the workflow if cache entry is not found. Default: false
description:'An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms'
default:'false'
required:false
fail-on-cache-miss:
description:'Fail the workflow if cache entry is not found'
default:'false'
required:false
outputs:
cache-hit:
description:'A boolean value to indicate an exact match was found for the primary key'
@ -7,6 +7,7 @@ The restore action, as the name suggest, restores a cache. It acts similar to th
* `path` - A list of files, directories, and wildcard patterns to cache and restore. See [`@actions/glob`](https://github.com/actions/toolkit/tree/main/packages/glob) for supported patterns.
* `key` - String used while saving cache for restoring the cache
* `restore-keys` - An ordered list of prefix-matched keys to use for restoring stale cache if no cache hit occurred for key.
* `fail-on-cache-miss` - Fail the workflow if cache entry is not found. Default: false
## Outputs
@ -95,7 +96,7 @@ steps:
### Exit workflow on cache miss
You can use the output of this action to exit the workflow on cache miss. This way you can restrict your workflow to only initiate the build when `cache-hit` occurs, in other words, cache with exact key is found.
You can use `fail-on-cache-miss: true` to exit the workflow on a cache miss. This way you can restrict your workflow to only initiate the build when a cache is matched. Also, if you want to fail if cache did not match primary key, additionally leave `restore-keys` empty!