mirror of
https://code.forgejo.org/actions/setup-python
synced 2025-06-09 04:42:20 +02:00
Add error handling for saving and restoring cache (#618)
This commit is contained in:
parent
b41aaf9f0c
commit
03eb867e3d
8 changed files with 694 additions and 1056 deletions
|
@ -39,13 +39,18 @@ abstract class CacheDistributor {
|
|||
const cachePath = await this.getCacheGlobalDirectories();
|
||||
|
||||
core.saveState(State.CACHE_PATHS, cachePath);
|
||||
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
|
||||
|
||||
const matchedKey = await cache.restoreCache(
|
||||
cachePath,
|
||||
primaryKey,
|
||||
restoreKey
|
||||
);
|
||||
let matchedKey: string | undefined;
|
||||
try {
|
||||
matchedKey = await cache.restoreCache(cachePath, primaryKey, restoreKey);
|
||||
} catch (err) {
|
||||
const message = (err as Error).message;
|
||||
core.info(`[warning]${message}`);
|
||||
core.setOutput('cache-hit', false);
|
||||
return;
|
||||
}
|
||||
|
||||
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
|
||||
|
||||
await this.handleLoadedCache();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue