mirror of
https://github.com/actions/cache.git
synced 2026-10-01 09:01:44 +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:
1 parent
8e3048d0f7
commit
627f0f41f6
15 files changed
+174
-15
No files matched your search
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user