mirror of
https://code.forgejo.org/actions/setup-go
synced 2025-06-10 20:42:22 +02:00
Rework cache handling
This commit is contained in:
parent
6036aa2424
commit
0fd92001e9
4 changed files with 69 additions and 49 deletions
|
@ -34,26 +34,17 @@ export const restoreCache = async (
|
|||
|
||||
core.saveState(State.CachePrimaryKey, primaryKey);
|
||||
|
||||
try {
|
||||
const cacheKey = await cache.restoreCache(cachePaths, primaryKey);
|
||||
core.setOutput(Outputs.CacheHit, Boolean(cacheKey));
|
||||
const cacheKey = await cache.restoreCache(cachePaths, primaryKey);
|
||||
core.setOutput(Outputs.CacheHit, Boolean(cacheKey));
|
||||
|
||||
if (!cacheKey) {
|
||||
core.info(`Cache is not found`);
|
||||
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);
|
||||
}
|
||||
if (!cacheKey) {
|
||||
core.info(`Cache is not found`);
|
||||
core.setOutput(Outputs.CacheHit, false);
|
||||
return;
|
||||
}
|
||||
|
||||
core.saveState(State.CacheMatchedKey, cacheKey);
|
||||
core.info(`Cache restored from key: ${cacheKey}`);
|
||||
};
|
||||
|
||||
const findDependencyFile = (packageManager: PackageManagerInfo) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue