diff --git a/.github/workflows/e2e-cache.yml b/.github/workflows/e2e-cache.yml index ce3366a1f..b67494048 100644 --- a/.github/workflows/e2e-cache.yml +++ b/.github/workflows/e2e-cache.yml @@ -43,12 +43,13 @@ jobs: steps: - uses: actions/checkout@v3 - name: Setup Python + id: setup-python uses: ./ with: python-version: ${{ matrix.python-version }} cache: 'pipenv' - name: Install pipenv - run: pipx install pipenv + run: pipx install pipenv --python ${{ steps.setup-python.outputs.python-path }} - name: Install dependencies run: | cd __tests__/data diff --git a/dist/cache-save/index.js b/dist/cache-save/index.js index 35cedd908..3689f58f4 100644 --- a/dist/cache-save/index.js +++ b/dist/cache-save/index.js @@ -57529,8 +57529,20 @@ class CacheDistributor { const cachePath = yield this.getCacheGlobalDirectories(); core.saveState(State.CACHE_PATHS, cachePath); core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey); - const matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey); - this.handleMatchResult(matchedKey, primaryKey); + try { + const matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey); + this.handleMatchResult(matchedKey, primaryKey); + } + catch (error) { + const typedError = error; + if (typedError.name === cache.ValidationError.name) { + throw error; + } + else { + core.warning(typedError.message); + core.setOutput('cache-hit', false); + } + } }); } handleMatchResult(matchedKey, primaryKey) { diff --git a/dist/setup/index.js b/dist/setup/index.js index 2b2504b07..2a64dcb11 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -63600,8 +63600,20 @@ class CacheDistributor { const cachePath = yield this.getCacheGlobalDirectories(); core.saveState(State.CACHE_PATHS, cachePath); core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey); - const matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey); - this.handleMatchResult(matchedKey, primaryKey); + try { + const matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey); + this.handleMatchResult(matchedKey, primaryKey); + } + catch (error) { + const typedError = error; + if (typedError.name === cache.ValidationError.name) { + throw error; + } + else { + core.warning(typedError.message); + core.setOutput('cache-hit', false); + } + } }); } handleMatchResult(matchedKey, primaryKey) { diff --git a/src/cache-distributions/cache-distributor.ts b/src/cache-distributions/cache-distributor.ts index f24c78dab..548bc9055 100644 --- a/src/cache-distributions/cache-distributor.ts +++ b/src/cache-distributions/cache-distributor.ts @@ -35,13 +35,23 @@ abstract class CacheDistributor { core.saveState(State.CACHE_PATHS, cachePath); core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey); - const matchedKey = await cache.restoreCache( - cachePath, - primaryKey, - restoreKey - ); + try { + const matchedKey = await cache.restoreCache( + cachePath, + primaryKey, + restoreKey + ); - this.handleMatchResult(matchedKey, primaryKey); + this.handleMatchResult(matchedKey, primaryKey); + } catch (error) { + const typedError = error as Error; + if (typedError.name === cache.ValidationError.name) { + throw error; + } else { + core.warning(typedError.message); + core.setOutput('cache-hit', false); + } + } } public handleMatchResult(matchedKey: string | undefined, primaryKey: string) {