diff --git a/lib/main.js b/lib/main.js index 914687c3..f3c01200 100644 --- a/lib/main.js +++ b/lib/main.js @@ -161,7 +161,21 @@ function run() { const binPath = yield tc.downloadTool(url); yield extractFn(binPath, dest); if (cacheEnabled && cacheKey !== undefined) { - yield cache.saveCache([dest], cacheKey); + try { + yield cache.saveCache([dest], cacheKey); + } + catch (error) { + const typedError = error; + if (typedError.name === cache.ValidationError.name) { + throw error; + } + else if (typedError.name === cache.ReserveCacheError.name) { + core.info(typedError.message); + } + else { + core.warning(typedError.message); + } + } } core.addPath(dest); core.info(`Successfully extracted ${project} to ${dest}`); diff --git a/src/main.ts b/src/main.ts index 290953c3..40739567 100644 --- a/src/main.ts +++ b/src/main.ts @@ -167,7 +167,18 @@ async function run() { await extractFn(binPath, dest); if (cacheEnabled && cacheKey !== undefined) { - await cache.saveCache([dest], cacheKey); + try { + await cache.saveCache([dest], cacheKey); + } catch (error) { + const typedError = error as Error; + if (typedError.name === cache.ValidationError.name) { + throw error; + } else if (typedError.name === cache.ReserveCacheError.name) { + core.info(typedError.message); + } else { + core.warning(typedError.message); + } + } } core.addPath(dest);