From dc910170394448f36dcfacf9633d7199091e562f Mon Sep 17 00:00:00 2001 From: krishanbhasin-gc Date: Fri, 21 Apr 2023 16:27:00 +0100 Subject: [PATCH] add a fallback restore-key for poetry cache --- __tests__/cache-restore.test.ts | 2 +- dist/setup/index.js | 4 ++-- src/cache-distributions/poetry-cache.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/__tests__/cache-restore.test.ts b/__tests__/cache-restore.test.ts index b4b48ad21..e3cbbc430 100644 --- a/__tests__/cache-restore.test.ts +++ b/__tests__/cache-restore.test.ts @@ -300,7 +300,7 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py result = 'pipenv cache is not found'; break; case 'poetry': - result = 'poetry cache is not found'; + result = `Cache restored from key: ${pipFileLockHash}`; break; } diff --git a/dist/setup/index.js b/dist/setup/index.js index ffdf03f9d..eff5ad354 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -66750,10 +66750,10 @@ class PoetryCache extends cache_distributor_1.default { const hash = yield glob.hashFiles(this.patterns); // "v2" is here to invalidate old caches of this cache distributor, which were created broken: const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-v2-${hash}`; - const restoreKey = undefined; + const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-`; return { primaryKey, - restoreKey + restoreKey: [restoreKey] }; }); } diff --git a/src/cache-distributions/poetry-cache.ts b/src/cache-distributions/poetry-cache.ts index c31fb05d4..616690938 100644 --- a/src/cache-distributions/poetry-cache.ts +++ b/src/cache-distributions/poetry-cache.ts @@ -48,10 +48,10 @@ class PoetryCache extends CacheDistributor { const hash = await glob.hashFiles(this.patterns); // "v2" is here to invalidate old caches of this cache distributor, which were created broken: const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-v2-${hash}`; - const restoreKey = undefined; + const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-`; return { primaryKey, - restoreKey + restoreKey: [restoreKey] }; }