From 27f9a7d4619bde4df165846e435d9e2795ab3bea Mon Sep 17 00:00:00 2001 From: Sampark Sharma Date: Wed, 7 Dec 2022 08:41:56 +0000 Subject: [PATCH] Revert Address review comments --- packages/cache/src/cache.ts | 22 +++++++++++----- .../cache/src/internal/cacheHttpClient.ts | 26 ------------------- 2 files changed, 16 insertions(+), 32 deletions(-) diff --git a/packages/cache/src/cache.ts b/packages/cache/src/cache.ts index b2185e5e..3840e439 100644 --- a/packages/cache/src/cache.ts +++ b/packages/cache/src/cache.ts @@ -97,12 +97,22 @@ export async function restoreCache( compressionMethod }) } catch (error) { - cacheEntry = await cacheHttpClient.getCacheEntryForGzipFallbackOnWindows( - keys, - paths, - compressionMethod, - error - ) + // This is to support the old cache entry created + // by the old version of the cache action on windows. + if ( + process.platform === 'win32' && + compressionMethod !== CompressionMethod.Gzip + ) { + compressionMethod = CompressionMethod.Gzip + cacheEntry = await cacheHttpClient.getCacheEntry(keys, paths, { + compressionMethod + }) + if (!cacheEntry?.archiveLocation) { + throw error + } + } else { + throw error + } } if (!cacheEntry?.archiveLocation) { diff --git a/packages/cache/src/internal/cacheHttpClient.ts b/packages/cache/src/internal/cacheHttpClient.ts index 04882612..c66d1a73 100644 --- a/packages/cache/src/internal/cacheHttpClient.ts +++ b/packages/cache/src/internal/cacheHttpClient.ts @@ -122,32 +122,6 @@ export async function getCacheEntry( return cacheResult } -// This is to support the old cache entry created -// by the old version of the cache action on windows. -export async function getCacheEntryForGzipFallbackOnWindows( - keys: string[], - paths: string[], - compressionMethod: CompressionMethod, - error: unknown -): Promise { - let cacheEntry: ArtifactCacheEntry | null - if ( - process.platform === 'win32' && - compressionMethod !== CompressionMethod.Gzip - ) { - compressionMethod = CompressionMethod.Gzip - cacheEntry = await getCacheEntry(keys, paths, { - compressionMethod - }) - if (!cacheEntry?.archiveLocation) { - throw error - } - } else { - throw error - } - return cacheEntry -} - export async function downloadCache( archiveLocation: string, archivePath: string,