mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-01-03 15:22:55 +08:00
Delete temporary archive after cache upload (#792)
This is to avoid filling the SSD while saving multiple large caches
This commit is contained in:
parent
a31b7eca9e
commit
4564768940
9
packages/cache/src/cache.ts
vendored
9
packages/cache/src/cache.ts
vendored
@ -166,6 +166,7 @@ export async function saveCache(
|
|||||||
|
|
||||||
core.debug(`Archive Path: ${archivePath}`)
|
core.debug(`Archive Path: ${archivePath}`)
|
||||||
|
|
||||||
|
try {
|
||||||
await createTar(archiveFolder, cachePaths, compressionMethod)
|
await createTar(archiveFolder, cachePaths, compressionMethod)
|
||||||
if (core.isDebug()) {
|
if (core.isDebug()) {
|
||||||
await listTar(archivePath, compressionMethod)
|
await listTar(archivePath, compressionMethod)
|
||||||
@ -184,6 +185,14 @@ export async function saveCache(
|
|||||||
|
|
||||||
core.debug(`Saving Cache (ID: ${cacheId})`)
|
core.debug(`Saving Cache (ID: ${cacheId})`)
|
||||||
await cacheHttpClient.saveCache(cacheId, archivePath, options)
|
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
|
return cacheId
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user