Skip to content

Commit 9e9f60b

Browse files
Merge pull request actions#285 from schuenadel/suggest-clear-cache-after-dependency-update
Remove `restoreKeys` to clear cache after update
2 parents 46f0194 + fa02725 commit 9e9f60b

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

dist/cleanup/index.js

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

dist/setup/index.js

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

src/cache.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,8 @@ export async function restore(id: string) {
9191
);
9292
}
9393

94-
const matchedKey = await cache.restoreCache(packageManager.path, primaryKey, [
95-
`${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${id}`
96-
]);
94+
// No "restoreKeys" is set, to start with a clear cache after dependency update (see https://github.com/actions/setup-java/issues/269)
95+
const matchedKey = await cache.restoreCache(packageManager.path, primaryKey);
9796
if (matchedKey) {
9897
core.saveState(CACHE_MATCHED_KEY, matchedKey);
9998
core.setOutput('cache-hit', matchedKey === primaryKey);

0 commit comments

Comments
 (0)