Skip to content

Commit

Permalink
Catch 'Artifact has expired' error
Browse files Browse the repository at this point in the history
  • Loading branch information
koplo199 committed Nov 12, 2022
1 parent e6e25ac commit 806bb52
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down

0 comments on commit 806bb52

Please sign in to comment.