mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2025-08-22 17:59:06 +08:00
Revert Address review comments
This commit is contained in:
parent
d79a09bc0e
commit
27f9a7d461
22
packages/cache/src/cache.ts
vendored
22
packages/cache/src/cache.ts
vendored
@ -97,12 +97,22 @@ export async function restoreCache(
|
|||||||
compressionMethod
|
compressionMethod
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
cacheEntry = await cacheHttpClient.getCacheEntryForGzipFallbackOnWindows(
|
// This is to support the old cache entry created
|
||||||
keys,
|
// by the old version of the cache action on windows.
|
||||||
paths,
|
if (
|
||||||
compressionMethod,
|
process.platform === 'win32' &&
|
||||||
error
|
compressionMethod !== CompressionMethod.Gzip
|
||||||
)
|
) {
|
||||||
|
compressionMethod = CompressionMethod.Gzip
|
||||||
|
cacheEntry = await cacheHttpClient.getCacheEntry(keys, paths, {
|
||||||
|
compressionMethod
|
||||||
|
})
|
||||||
|
if (!cacheEntry?.archiveLocation) {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cacheEntry?.archiveLocation) {
|
if (!cacheEntry?.archiveLocation) {
|
||||||
|
26
packages/cache/src/internal/cacheHttpClient.ts
vendored
26
packages/cache/src/internal/cacheHttpClient.ts
vendored
@ -122,32 +122,6 @@ export async function getCacheEntry(
|
|||||||
return cacheResult
|
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<ArtifactCacheEntry> {
|
|
||||||
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(
|
export async function downloadCache(
|
||||||
archiveLocation: string,
|
archiveLocation: string,
|
||||||
archivePath: string,
|
archivePath: string,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user