mirror of
https://github.com/actions/cache.git
synced 2025-04-22 03:56:45 +00:00
Consuming 3.0 actions/cache
This commit is contained in:
parent
a0efc56c52
commit
c75dca6de7
7 changed files with 127 additions and 119 deletions
21
src/save.ts
21
src/save.ts
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue