diff --git a/dist/restore/index.js b/dist/restore/index.js index 4c50266..07d9005 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -48986,6 +48986,9 @@ function run() { }); const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys); if (!cacheKey) { + if (core.getInput(constants_1.Inputs.StrictRestore) == "true") { + throw new Error("Cache with given key not found, hence exiting the workflow as the strict-restore requirement is not met."); + } core.info(`Cache not found for input keys: ${[ primaryKey, ...restoreKeys @@ -48997,7 +49000,7 @@ function run() { const isExactKeyMatch = utils.isExactKeyMatch(primaryKey, cacheKey); utils.setCacheHitOutput(isExactKeyMatch); if (!isExactKeyMatch && core.getInput(constants_1.Inputs.StrictRestore) == "true") { - throw new Error("Restored cache doesn't match the key in the input, hence exiting the workflow as strict-restore requirement is not met."); + throw new Error("Restored cache doesn't match the key in the input, hence exiting the workflow as the strict-restore requirement is not met."); } core.info(`Cache restored from key: ${cacheKey}`); } diff --git a/src/restore.ts b/src/restore.ts index ae7953f..1049bc6 100644 --- a/src/restore.ts +++ b/src/restore.ts @@ -36,6 +36,11 @@ async function run(): Promise { ); if (!cacheKey) { + if (core.getInput(Inputs.StrictRestore) == "true") { + throw new Error( + "Cache with given key not found, hence exiting the workflow as the strict-restore requirement is not met." + ); + } core.info( `Cache not found for input keys: ${[ primaryKey, @@ -54,7 +59,7 @@ async function run(): Promise { if (!isExactKeyMatch && core.getInput(Inputs.StrictRestore) == "true") { throw new Error( - "Restored cache doesn't match the key in the input, hence exiting the workflow as strict-restore requirement is not met." + "Restored cache doesn't match the key in the input, hence exiting the workflow as the strict-restore requirement is not met." ); } core.info(`Cache restored from key: ${cacheKey}`);