1
0
Fork 0

restoreCache only cleanup in finally if archivePath is set

pull/1647/head
Josh Soref 2024-01-30 23:59:06 -05:00
parent 1fe633e27c
commit 5c8d5f1e26
1 changed files with 7 additions and 5 deletions

View File

@ -142,11 +142,13 @@ export async function restoreCache(
core.warning(`Failed to restore: ${(error as Error).message}`)
}
} finally {
// Try to delete the archive to save space
try {
await utils.unlinkFile(archivePath)
} catch (error) {
core.debug(`Failed to delete archive: ${error}`)
if (archivePath) {
// Try to delete the archive to save space
try {
await utils.unlinkFile(archivePath)
} catch (error) {
core.debug(`Failed to delete archive: ${error}`)
}
}
}