Skip to content

Commit 955873a

Browse files
add a fallback restore-key for poetry cache
1 parent 6db7460 commit 955873a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

__tests__/cache-restore.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
300300
result = 'pipenv cache is not found';
301301
break;
302302
case 'poetry':
303-
result = 'poetry cache is not found';
303+
result = `Cache restored from key: ${pipFileLockHash}`;
304304
break;
305305
}
306306

src/cache-distributions/poetry-cache.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ class PoetryCache extends CacheDistributor {
4848
const hash = await glob.hashFiles(this.patterns);
4949
// "v2" is here to invalidate old caches of this cache distributor, which were created broken:
5050
const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-v2-${hash}`;
51-
const restoreKey = undefined;
51+
const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-`;
5252
return {
5353
primaryKey,
54-
restoreKey
54+
restoreKey: [restoreKey]
5555
};
5656
}
5757

0 commit comments

Comments
 (0)