Merge pull request #285 from schuenadel/suggest-clear-cache-after-dependency-update

Remove `restoreKeys` to clear cache after update
This commit is contained in:
Marko Zivic 2022-07-15 09:21:07 +02:00 committed by GitHub
commit 9e9f60b996
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 9 deletions

View File

@ -66227,9 +66227,8 @@ function restore(id) {
if (primaryKey.endsWith('-')) { if (primaryKey.endsWith('-')) {
throw new Error(`No file in ${process.cwd()} matched to [${packageManager.pattern}], make sure you have checked out the target repository`); throw new Error(`No file in ${process.cwd()} matched to [${packageManager.pattern}], make sure you have checked out the target repository`);
} }
const matchedKey = yield cache.restoreCache(packageManager.path, primaryKey, [ // No "restoreKeys" is set, to start with a clear cache after dependency update (see https://github.com/actions/setup-java/issues/269)
`${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${id}` const matchedKey = yield cache.restoreCache(packageManager.path, primaryKey);
]);
if (matchedKey) { if (matchedKey) {
core.saveState(CACHE_MATCHED_KEY, matchedKey); core.saveState(CACHE_MATCHED_KEY, matchedKey);
core.setOutput('cache-hit', matchedKey === primaryKey); core.setOutput('cache-hit', matchedKey === primaryKey);

5
dist/setup/index.js vendored
View File

@ -101432,9 +101432,8 @@ function restore(id) {
if (primaryKey.endsWith('-')) { if (primaryKey.endsWith('-')) {
throw new Error(`No file in ${process.cwd()} matched to [${packageManager.pattern}], make sure you have checked out the target repository`); throw new Error(`No file in ${process.cwd()} matched to [${packageManager.pattern}], make sure you have checked out the target repository`);
} }
const matchedKey = yield cache.restoreCache(packageManager.path, primaryKey, [ // No "restoreKeys" is set, to start with a clear cache after dependency update (see https://github.com/actions/setup-java/issues/269)
`${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${id}` const matchedKey = yield cache.restoreCache(packageManager.path, primaryKey);
]);
if (matchedKey) { if (matchedKey) {
core.saveState(CACHE_MATCHED_KEY, matchedKey); core.saveState(CACHE_MATCHED_KEY, matchedKey);
core.setOutput('cache-hit', matchedKey === primaryKey); core.setOutput('cache-hit', matchedKey === primaryKey);

View File

@ -91,9 +91,8 @@ export async function restore(id: string) {
); );
} }
const matchedKey = await cache.restoreCache(packageManager.path, primaryKey, [ // No "restoreKeys" is set, to start with a clear cache after dependency update (see https://github.com/actions/setup-java/issues/269)
`${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${id}` const matchedKey = await cache.restoreCache(packageManager.path, primaryKey);
]);
if (matchedKey) { if (matchedKey) {
core.saveState(CACHE_MATCHED_KEY, matchedKey); core.saveState(CACHE_MATCHED_KEY, matchedKey);
core.setOutput('cache-hit', matchedKey === primaryKey); core.setOutput('cache-hit', matchedKey === primaryKey);