mirror of
https://github.com/actions/setup-python.git
synced 2025-04-24 15:32:13 +00:00
Build action with cache-hit output
This commit is contained in:
parent
c933f3c50e
commit
fa50ad5388
3 changed files with 25 additions and 14 deletions
7
dist/cache-save/index.js
vendored
7
dist/cache-save/index.js
vendored
|
@ -37234,6 +37234,10 @@ class CacheDistributor {
|
|||
core.saveState(State.CACHE_PATHS, cachePath);
|
||||
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
|
||||
const matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey);
|
||||
this.handleMatchResult(matchedKey);
|
||||
});
|
||||
}
|
||||
handleMatchResult(matchedKey) {
|
||||
if (matchedKey) {
|
||||
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
|
||||
core.info(`Cache restored from key: ${matchedKey}`);
|
||||
|
@ -37241,7 +37245,8 @@ class CacheDistributor {
|
|||
else {
|
||||
core.info(`${this.packageManager} cache is not found`);
|
||||
}
|
||||
});
|
||||
core.info('cache was hit');
|
||||
core.setOutput('cache-hit', Boolean(matchedKey));
|
||||
}
|
||||
}
|
||||
exports.default = CacheDistributor;
|
||||
|
|
7
dist/setup/index.js
vendored
7
dist/setup/index.js
vendored
|
@ -42579,6 +42579,10 @@ class CacheDistributor {
|
|||
core.saveState(State.CACHE_PATHS, cachePath);
|
||||
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
|
||||
const matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey);
|
||||
this.handleMatchResult(matchedKey);
|
||||
});
|
||||
}
|
||||
handleMatchResult(matchedKey) {
|
||||
if (matchedKey) {
|
||||
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
|
||||
core.info(`Cache restored from key: ${matchedKey}`);
|
||||
|
@ -42586,7 +42590,8 @@ class CacheDistributor {
|
|||
else {
|
||||
core.info(`${this.packageManager} cache is not found`);
|
||||
}
|
||||
});
|
||||
core.info('cache was hit');
|
||||
core.setOutput('cache-hit', Boolean(matchedKey));
|
||||
}
|
||||
}
|
||||
exports.default = CacheDistributor;
|
||||
|
|
|
@ -54,6 +54,7 @@ abstract class CacheDistributor {
|
|||
} else {
|
||||
core.info(`${this.packageManager} cache is not found`);
|
||||
}
|
||||
core.info('cache was hit');
|
||||
core.setOutput('cache-hit', Boolean(matchedKey));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue