From 806bb52fe0932bb09fc232c570628a680ac9edd2 Mon Sep 17 00:00:00 2001 From: koplo199 <85577251+koplo199@users.noreply.github.com> Date: Sat, 12 Nov 2022 15:23:41 +0100 Subject: [PATCH 1/2] Catch 'Artifact has expired' error --- main.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index 18f5654f..ba6668ba 100644 --- a/main.js +++ b/main.js @@ -218,12 +218,21 @@ async function main() { core.info(`==> Downloading: ${artifact.name}.zip (${size})`) - const zip = await client.rest.actions.downloadArtifact({ - owner: owner, - repo: repo, - artifact_id: artifact.id, - archive_format: "zip", - }) + let zip; + try { + zip = await client.rest.actions.downloadArtifact({ + owner: owner, + repo: repo, + artifact_id: artifact.id, + archive_format: "zip", + }) + } catch (error) { + if (error.message === "Artifact has expired") { + return setExitMessage(ifNoArtifactFound, "no downloadable artifacts found (expired)") + } else { + throw new Error(error.message) + } + } if (skipUnpack) { fs.mkdirSync(path, { recursive: true }) From ceeb280c4fe021932f278832823a149fba4997dd Mon Sep 17 00:00:00 2001 From: koplo199 <85577251+koplo199@users.noreply.github.com> Date: Sat, 12 Nov 2022 17:24:07 +0000 Subject: [PATCH 2/2] Remove unnecessary semicolon Co-authored-by: Dawid Dziurla --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index ba6668ba..a14c8903 100644 --- a/main.js +++ b/main.js @@ -218,7 +218,7 @@ async function main() { core.info(`==> Downloading: ${artifact.name}.zip (${size})`) - let zip; + let zip try { zip = await client.rest.actions.downloadArtifact({ owner: owner,