From eaead3517c1eac8d9276d5964db5d7572d13a396 Mon Sep 17 00:00:00 2001 From: IvanZosimov Date: Mon, 27 Jun 2022 10:11:42 +0200 Subject: [PATCH] Update cache-save.ts to support @actions/cache v3.0.0 lib --- dist/cache-save/index.js | 18 ++++-------------- src/cache-save.ts | 16 +++++----------- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/dist/cache-save/index.js b/dist/cache-save/index.js index 8ec9238e..219ef59f 100644 --- a/dist/cache-save/index.js +++ b/dist/cache-save/index.js @@ -59888,21 +59888,11 @@ const cachePackages = (packageManager) => __awaiter(void 0, void 0, void 0, func core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); return; } - try { - yield cache.saveCache([cachePath], primaryKey); - core.info(`Cache saved with the key: ${primaryKey}`); - } - catch (error) { - if (error.name === cache.ValidationError.name) { - throw error; - } - else if (error.name === cache.ReserveCacheError.name) { - core.info(error.message); - } - else { - core.warning(`${error.message}`); - } + const cacheId = yield cache.saveCache([cachePath], primaryKey); + if (cacheId == -1) { + return; } + core.info(`Cache saved with the key: ${primaryKey}`); }); run(); diff --git a/src/cache-save.ts b/src/cache-save.ts index 34115559..24565a8e 100644 --- a/src/cache-save.ts +++ b/src/cache-save.ts @@ -49,18 +49,12 @@ const cachePackages = async (packageManager: string) => { return; } - try { - await cache.saveCache([cachePath], primaryKey); - core.info(`Cache saved with the key: ${primaryKey}`); - } catch (error) { - if (error.name === cache.ValidationError.name) { - throw error; - } else if (error.name === cache.ReserveCacheError.name) { - core.info(error.message); - } else { - core.warning(`${error.message}`); - } + const cacheId = await cache.saveCache([cachePath], primaryKey); + if (cacheId == -1) { + return; } + + core.info(`Cache saved with the key: ${primaryKey}`); }; run();