Skip to content

Commit 806bb52

Browse files
committed
Catch 'Artifact has expired' error
1 parent e6e25ac commit 806bb52

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

main.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,21 @@ async function main() {
218218

219219
core.info(`==> Downloading: ${artifact.name}.zip (${size})`)
220220

221-
const zip = await client.rest.actions.downloadArtifact({
222-
owner: owner,
223-
repo: repo,
224-
artifact_id: artifact.id,
225-
archive_format: "zip",
226-
})
221+
let zip;
222+
try {
223+
zip = await client.rest.actions.downloadArtifact({
224+
owner: owner,
225+
repo: repo,
226+
artifact_id: artifact.id,
227+
archive_format: "zip",
228+
})
229+
} catch (error) {
230+
if (error.message === "Artifact has expired") {
231+
return setExitMessage(ifNoArtifactFound, "no downloadable artifacts found (expired)")
232+
} else {
233+
throw new Error(error.message)
234+
}
235+
}
227236

228237
if (skipUnpack) {
229238
fs.mkdirSync(path, { recursive: true })

0 commit comments

Comments
 (0)