1
0
Fork 0

Delete temporary archive after cache upload (#792)

This is to avoid filling the SSD while saving multiple large caches
pull/858/head
Rob Cowsill 2021-06-28 16:27:09 +01:00 committed by GitHub
parent a31b7eca9e
commit 4564768940
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 16 deletions

View File

@ -166,6 +166,7 @@ export async function saveCache(
core.debug(`Archive Path: ${archivePath}`)
try {
await createTar(archiveFolder, cachePaths, compressionMethod)
if (core.isDebug()) {
await listTar(archivePath, compressionMethod)
@ -184,6 +185,14 @@ export async function saveCache(
core.debug(`Saving Cache (ID: ${cacheId})`)
await cacheHttpClient.saveCache(cacheId, archivePath, options)
} finally {
// Try to delete the archive to save space
try {
await utils.unlinkFile(archivePath)
} catch (error) {
core.debug(`Failed to delete archive: ${error}`)
}
}
return cacheId
}