Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch 'Artifact has expired' error #211

Merged
merged 2 commits into from Nov 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 15 additions & 6 deletions main.js
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