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 })