mirror of
https://github.com/actions/cache.git
synced 2025-04-21 19:46:46 +00:00
Add fail-on-cache-miss
option (#1036)
* 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
This commit is contained in:
parent
8e3048d0f7
commit
627f0f41f6
15 changed files with 174 additions and 15 deletions
|
@ -34,6 +34,7 @@ async function restoreImpl(
|
|||
const enableCrossOsArchive = utils.getInputAsBool(
|
||||
Inputs.EnableCrossOsArchive
|
||||
);
|
||||
const failOnCacheMiss = utils.getInputAsBool(Inputs.FailOnCacheMiss);
|
||||
|
||||
const cacheKey = await cache.restoreCache(
|
||||
cachePaths,
|
||||
|
@ -44,6 +45,11 @@ async function restoreImpl(
|
|||
);
|
||||
|
||||
if (!cacheKey) {
|
||||
if (failOnCacheMiss) {
|
||||
throw new Error(
|
||||
`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}`
|
||||
);
|
||||
}
|
||||
core.info(
|
||||
`Cache not found for input keys: ${[
|
||||
primaryKey,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue