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
19
dist/cache-save/index.js
vendored
19
dist/cache-save/index.js
vendored
|
@ -37234,15 +37234,20 @@ class CacheDistributor {
|
|||
core.saveState(State.CACHE_PATHS, cachePath);
|
||||
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
|
||||
const matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey);
|
||||
if (matchedKey) {
|
||||
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
|
||||
core.info(`Cache restored from key: ${matchedKey}`);
|
||||
}
|
||||
else {
|
||||
core.info(`${this.packageManager} cache is not found`);
|
||||
}
|
||||
this.handleMatchResult(matchedKey);
|
||||
});
|
||||
}
|
||||
handleMatchResult(matchedKey) {
|
||||
if (matchedKey) {
|
||||
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
|
||||
core.info(`Cache restored from key: ${matchedKey}`);
|
||||
}
|
||||
else {
|
||||
core.info(`${this.packageManager} cache is not found`);
|
||||
}
|
||||
core.info('cache was hit');
|
||||
core.setOutput('cache-hit', Boolean(matchedKey));
|
||||
}
|
||||
}
|
||||
exports.default = CacheDistributor;
|
||||
|
||||
|
|
19
dist/setup/index.js
vendored
19
dist/setup/index.js
vendored
|
@ -42579,15 +42579,20 @@ class CacheDistributor {
|
|||
core.saveState(State.CACHE_PATHS, cachePath);
|
||||
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
|
||||
const matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey);
|
||||
if (matchedKey) {
|
||||
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
|
||||
core.info(`Cache restored from key: ${matchedKey}`);
|
||||
}
|
||||
else {
|
||||
core.info(`${this.packageManager} cache is not found`);
|
||||
}
|
||||
this.handleMatchResult(matchedKey);
|
||||
});
|
||||
}
|
||||
handleMatchResult(matchedKey) {
|
||||
if (matchedKey) {
|
||||
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
|
||||
core.info(`Cache restored from key: ${matchedKey}`);
|
||||
}
|
||||
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