1
0
Fork 0
mirror of https://code.forgejo.org/actions/setup-python synced 2025-06-08 04:18:19 +02:00

Cache hit output (#373)

* Remove useless await in getCacheDistributor calls

* Added cache-hit output

* Build action with cache-hit output

* Remove PromiseReturnType, add matchedKey == primaryKey check

* Update cache-distributor.ts

* Fix tests and rebuild
This commit is contained in:
Alexey 2022-04-05 06:57:13 -07:00 committed by GitHub
parent 7933d5a3dd
commit 21c0493ecf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 68 additions and 17 deletions

View file

@ -37234,15 +37234,19 @@ 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, primaryKey);
});
}
handleMatchResult(matchedKey, primaryKey) {
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.setOutput('cache-hit', matchedKey === primaryKey);
}
}
exports.default = CacheDistributor;