diff --git a/__tests__/restoreCacheV2.test.ts b/__tests__/restoreCacheV2.test.ts index 485b8ae..bc14f25 100644 --- a/__tests__/restoreCacheV2.test.ts +++ b/__tests__/restoreCacheV2.test.ts @@ -265,6 +265,7 @@ test('restore with zstd compressed cache found', async () => { const cacheKey = await restoreCache(paths, key, [], options) expect(cacheKey).toBe(key) + expect(logInfoMock).toHaveBeenCalledWith(`Cache hit for: ${key}`) expect(getCacheVersionMock).toHaveBeenCalledWith( paths, compressionMethod, @@ -342,6 +343,9 @@ test('restore with cache found for restore key', async () => { const cacheKey = await restoreCache(paths, key, restoreKeys, options) expect(cacheKey).toBe(restoreKeys[0]) + expect(logInfoMock).toHaveBeenCalledWith( + `Cache hit for restore-key: ${restoreKeys[0]}` + ) expect(getCacheVersionMock).toHaveBeenCalledWith( paths, compressionMethod, diff --git a/src/cache.ts b/src/cache.ts index f7b2d19..c2970db 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -264,7 +264,12 @@ async function restoreCacheV2( 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) { core.info('Lookup only - skipping download')