diff --git a/packages/cache/__tests__/restoreCacheV2.test.ts b/packages/cache/__tests__/restoreCacheV2.test.ts index 485b8aeb..bc14f25a 100644 --- a/packages/cache/__tests__/restoreCacheV2.test.ts +++ b/packages/cache/__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/packages/cache/src/cache.ts b/packages/cache/src/cache.ts index f7b2d193..c2970dba 100644 --- a/packages/cache/src/cache.ts +++ b/packages/cache/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')