1
0
Fork 0

removes duplicate extraction

pull/1935/head
Prajjwal 2024-06-03 17:01:03 +05:30
parent b719dac88b
commit d78ac4e851
2 changed files with 16 additions and 18 deletions

View File

@ -1,6 +1,6 @@
{
"name": "github-actions.warp-cache",
"version": "1.1.14",
"version": "1.1.15",
"preview": true,
"description": "Github action to use WarpBuild's in-house cache offering",
"keywords": [

View File

@ -123,7 +123,7 @@ export async function restoreCache(
)
core.debug(`Archive Path: ${archivePath}`)
let cacheKey: string = ''
let cacheKey = cacheEntry?.cache_entry?.cache_user_given_key ?? primaryKey
switch (cacheEntry.provider) {
case 's3': {
@ -131,8 +131,6 @@ export async function restoreCache(
return undefined
}
cacheKey = cacheEntry.s3.pre_signed_url
if (options?.lookupOnly) {
core.info('Lookup only - skipping download')
return cacheKey
@ -167,20 +165,21 @@ export async function restoreCache(
core.info('Cache Miss. Failed to download cache.')
return undefined
}
if (core.isDebug()) {
await listTar(archivePath, compressionMethod)
}
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath)
core.info(
`Cache Size: ~${Math.round(
archiveFileSize / (1024 * 1024)
)} MB (${archiveFileSize} B)`
)
await extractTar(archivePath, compressionMethod)
}
if (core.isDebug()) {
await listTar(archivePath, compressionMethod)
}
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath)
core.info(
`Cache Size: ~${Math.round(
archiveFileSize / (1024 * 1024)
)} MB (${archiveFileSize} B)`
)
await extractTar(archivePath, compressionMethod)
core.info('Cache restored successfully')
break
}
@ -189,7 +188,6 @@ export async function restoreCache(
if (!cacheEntry.gcs?.cache_key) {
return undefined
}
cacheKey = cacheEntry.gcs?.cache_key
if (options?.lookupOnly) {
core.info('Lookup only - skipping download')
@ -280,7 +278,7 @@ export async function restoreCache(
}
}
return cacheEntry?.cache_entry?.cache_user_given_key ?? cacheKey
return cacheKey
} catch (error) {
const typedError = error as Error
if (typedError.name === ValidationError.name) {