From 68ab87caa2c73b0abb2011bfc6bb5243836d72c3 Mon Sep 17 00:00:00 2001 From: Bassem Dghaidi <568794+Link-@users.noreply.github.com> Date: Thu, 14 Nov 2024 15:49:02 +0100 Subject: [PATCH] Add check to make sure archive has been created already Co-authored-by: Josh Gross --- packages/cache/src/cache.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/cache/src/cache.ts b/packages/cache/src/cache.ts index 7d0cd000..6567cabf 100644 --- a/packages/cache/src/cache.ts +++ b/packages/cache/src/cache.ts @@ -296,7 +296,9 @@ async function restoreCachev2( throw new Error(`Failed to restore: ${error.message}`) } finally { try { - await utils.unlinkFile(archivePath) + if (archivePath) { + await utils.unlinkFile(archivePath) + } } catch (error) { core.debug(`Failed to delete archive: ${error}`) }