mirror of
https://github.com/actions/setup-python.git
synced 2025-07-03 16:13:47 +00:00
poetry: Run poetry env use
only after cache is loaded
The virtualenv cache might contain invalid entries, such as virtualenvs built in previous, buggy versions of this action. The `poetry env use` command will recreate virtualenvs in case they are invalid, but it has to be run only *after* the cache is loaded. Refactor `CacheDistributor` a bit such that the validation (and possible recreation) of virtualenvs happens only after the cache is loaded.
This commit is contained in:
parent
bc3992ed30
commit
881ca6e477
4 changed files with 68 additions and 34 deletions
4
dist/cache-save/index.js
vendored
4
dist/cache-save/index.js
vendored
|
@ -59711,6 +59711,9 @@ class CacheDistributor {
|
|||
this.cacheDependencyPath = cacheDependencyPath;
|
||||
this.CACHE_KEY_PREFIX = 'setup-python';
|
||||
}
|
||||
handleLoadedCache() {
|
||||
return __awaiter(this, void 0, void 0, function* () { });
|
||||
}
|
||||
restoreCache() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { primaryKey, restoreKey } = yield this.computeKeys();
|
||||
|
@ -59723,6 +59726,7 @@ class CacheDistributor {
|
|||
core.saveState(State.CACHE_PATHS, cachePath);
|
||||
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
|
||||
const matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey);
|
||||
yield this.handleLoadedCache();
|
||||
this.handleMatchResult(matchedKey, primaryKey);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue