3
0
Fork 0
mirror of https://gitea.com/actions/setup-node.git synced 2024-11-22 01:59:32 +01:00

Update cache-save.ts to support @actions/cache v3.0.0 lib

This commit is contained in:
IvanZosimov 2022-06-27 10:11:42 +02:00
parent 11c7f932ce
commit eaead3517c
2 changed files with 9 additions and 25 deletions

View file

@ -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();

View file

@ -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();