Consuming 3.0 actions/cache

This commit is contained in:
Shubham Tiwari 2022-06-24 04:06:33 +00:00 committed by GitHub
parent a0efc56c52
commit c75dca6de7
7 changed files with 127 additions and 119 deletions

View file

@ -44,21 +44,14 @@ async function run(): Promise<void> {
required: true
});
try {
await cache.saveCache(cachePaths, primaryKey, {
uploadChunkSize: utils.getInputAsInt(Inputs.UploadChunkSize)
});
core.info(`Cache saved with key: ${primaryKey}`);
} catch (error: unknown) {
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 {
utils.logWarning(typedError.message);
}
const cacheId = await cache.saveCache(cachePaths, primaryKey, {
uploadChunkSize: utils.getInputAsInt(Inputs.UploadChunkSize)
});
if (cacheId == -1 ) {
return;
}
core.info(`Cache saved with key: ${primaryKey}`);
} catch (error: unknown) {
utils.logWarning((error as Error).message);
}