Address review comments

This commit is contained in:
Sampark Sharma
2022-12-07 08:27:08 +00:00
committed by GitHub
parent d1094e1523
commit d79a09bc0e
3 changed files with 37 additions and 22 deletions
+10 -21
View File
@@ -96,30 +96,19 @@ export async function restoreCache(
cacheEntry = await cacheHttpClient.getCacheEntry(keys, paths, {
compressionMethod
})
if (!cacheEntry?.archiveLocation) {
// Cache not found
return undefined
}
} catch (error) {
if (
process.platform === 'win32' &&
compressionMethod !== CompressionMethod.Gzip
) {
// This is to support the old cache entry created
// by the old version of the cache action on windows.
compressionMethod = CompressionMethod.Gzip
cacheEntry = await cacheHttpClient.getCacheEntry(keys, paths, {
compressionMethod
})
if (!cacheEntry?.archiveLocation) {
throw error
}
} else {
throw error
}
cacheEntry = await cacheHttpClient.getCacheEntryForGzipFallbackOnWindows(
keys,
paths,
compressionMethod,
error
)
}
if (!cacheEntry?.archiveLocation) {
// Cache not found
return undefined
}
archivePath = path.join(
await utils.createTempDirectory(),
utils.getCacheFileName(compressionMethod)