Skip to content

Commit 0f7b0d6

Browse files
authored
Set cache-hit to true if any cache key matched (#244)
1 parent e962bc7 commit 0f7b0d6

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

dist/save-cache/index.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/save-cache/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup/index.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/restore-cache.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export async function restoreCache(
2828
}
2929

3030
let matchedKey: string | undefined
31+
core.info(`Trying to restore cache with key: ${cacheKey}`)
3132
try {
3233
matchedKey = cacheLocalStoragePath
3334
? await restoreCacheLocal(cacheKey)
@@ -63,10 +64,11 @@ function handleMatchResult(
6364
if (matchedKey) {
6465
core.saveState(STATE_CACHE_MATCHED_KEY, matchedKey)
6566
core.info(`Cache restored from key: ${matchedKey}`)
67+
core.setOutput('cache-hit', true)
6668
} else {
6769
core.info(`No cache found for key: ${primaryKey}`)
70+
core.setOutput('cache-hit', false)
6871
}
69-
core.setOutput('cache-hit', matchedKey === primaryKey)
7072
}
7173

7274
async function restoreCacheLocal(

0 commit comments

Comments
 (0)