Skip to content

Commit

Permalink
Merge pull request #211 from koplo199/master
Browse files Browse the repository at this point in the history
Catch 'Artifact has expired' error
  • Loading branch information
dawidd6 authored Nov 12, 2022
2 parents e6e25ac + ceeb280 commit dcadc4b
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 dcadc4b

Please sign in to comment.