Bump @actions/cache to 5.1.0, handle cache write denied (#1026)

This commit is contained in:
Jason Ginchereau
2026-06-21 22:16:01 -10:00
committed by GitHub
parent baa1691374
commit 6e9017e125
7 changed files with 126 additions and 22 deletions
+9 -1
View File
@@ -146,7 +146,15 @@ export async function save(id: string) {
return;
}
try {
await cache.saveCache(packageManager.path, primaryKey);
const cacheId = await cache.saveCache(packageManager.path, primaryKey);
if (cacheId === -1) {
// saveCache returns -1 without throwing when the cache was not saved,
// e.g. a reserve collision or a read-only token (fork PR). @actions/cache
// has already logged the reason at the appropriate severity, so just
// trace it instead of misreporting that the cache was saved.
core.debug(`Cache was not saved for the key: ${primaryKey}`);
return;
}
core.info(`Cache saved with the key: ${primaryKey}`);
} catch (error) {
const err = error as Error;