mirror of
https://github.com/actions/setup-go.git
synced 2025-04-23 17:40:50 +00:00
Add cache error handling
This commit is contained in:
parent
0039f448c5
commit
6d1722f03d
2 changed files with 2558 additions and 2536 deletions
5068
dist/setup/index.js
vendored
5068
dist/setup/index.js
vendored
File diff suppressed because it is too large
Load diff
|
@ -34,16 +34,26 @@ export const restoreCache = async (
|
||||||
|
|
||||||
core.saveState(State.CachePrimaryKey, primaryKey);
|
core.saveState(State.CachePrimaryKey, primaryKey);
|
||||||
|
|
||||||
const cacheKey = await cache.restoreCache(cachePaths, primaryKey);
|
try {
|
||||||
core.setOutput(Outputs.CacheHit, Boolean(cacheKey));
|
const cacheKey = await cache.restoreCache(cachePaths, primaryKey);
|
||||||
|
core.setOutput(Outputs.CacheHit, Boolean(cacheKey));
|
||||||
|
|
||||||
if (!cacheKey) {
|
if (!cacheKey) {
|
||||||
core.info(`Cache is not found`);
|
core.info(`Cache is not found`);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
core.saveState(State.CacheMatchedKey, cacheKey);
|
||||||
|
core.info(`Cache restored from key: ${cacheKey}`);
|
||||||
|
} catch (error) {
|
||||||
|
const typedError = error as Error;
|
||||||
|
if (typedError.name === cache.ValidationError.name) {
|
||||||
|
throw error;
|
||||||
|
} else {
|
||||||
|
core.warning(typedError.message);
|
||||||
|
core.setOutput(Outputs.CacheHit, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
core.saveState(State.CacheMatchedKey, cacheKey);
|
|
||||||
core.info(`Cache restored from key: ${cacheKey}`);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const findDependencyFile = (packageManager: PackageManagerInfo) => {
|
const findDependencyFile = (packageManager: PackageManagerInfo) => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue