Fix logging of cache key and restore key matches

This commit is contained in:
Bassem Dghaidi
2025-07-14 03:45:17 -07:00
committed by GitHub
parent 683703c114
commit 0c5da92b52
2 changed files with 28 additions and 21 deletions
+2
View File
@@ -265,6 +265,7 @@ test('restore with zstd compressed cache found', async () => {
const cacheKey = await restoreCache(paths, key, [], options) const cacheKey = await restoreCache(paths, key, [], options)
expect(cacheKey).toBe(key) expect(cacheKey).toBe(key)
expect(logInfoMock).toHaveBeenCalledWith(`Cache hit for: ${key}`)
expect(getCacheVersionMock).toHaveBeenCalledWith( expect(getCacheVersionMock).toHaveBeenCalledWith(
paths, paths,
compressionMethod, compressionMethod,
@@ -342,6 +343,7 @@ test('restore with cache found for restore key', async () => {
const cacheKey = await restoreCache(paths, key, restoreKeys, options) const cacheKey = await restoreCache(paths, key, restoreKeys, options)
expect(cacheKey).toBe(restoreKeys[0]) expect(cacheKey).toBe(restoreKeys[0])
expect(logInfoMock).toHaveBeenCalledWith(`Cache hit for restore-key: ${restoreKeys[0]}`)
expect(getCacheVersionMock).toHaveBeenCalledWith( expect(getCacheVersionMock).toHaveBeenCalledWith(
paths, paths,
compressionMethod, compressionMethod,
+6 -1
View File
@@ -264,7 +264,12 @@ async function restoreCacheV2(
return undefined return undefined
} }
core.info(`Cache hit for: ${request.key}`) const isRestoreKeyMatch = request.key !== response.matchedKey
if (isRestoreKeyMatch) {
core.info(`Cache hit for restore-key: ${response.matchedKey}`)
} else {
core.info(`Cache hit for: ${response.matchedKey}`)
}
if (options?.lookupOnly) { if (options?.lookupOnly) {
core.info('Lookup only - skipping download') core.info('Lookup only - skipping download')