Skip to content

Commit

Permalink
more catch blocks on asyncs to fail actions correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
craig-day committed Mar 23, 2021
1 parent 1ad670d commit d802d1f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions action.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ async function computeLastTag(givenTag, branch = null) {
if (recentTags.length < 1) {
return null
} else {
return findMatchingLastTag(recentTags, branch)
return findMatchingLastTag(recentTags, branch).catch((error) => {
core.setFailed(`Failed to mind matching last tag with error ${error}`)
})
}
} else {
return givenTag
Expand Down Expand Up @@ -218,14 +220,18 @@ async function computeNextTag() {
}

async function run() {
const nextTag = await computeNextTag()
const nextTag = await computeNextTag().catch((error) => {
core.setFailed(`Failed to compute next tag with error ${error}`)
})

core.info(`Computed the next tag as: ${nextTag}`)
core.setOutput('next_tag', nextTag)
}

try {
run()
run().catch((error) => {
core.setFailed(`Action failed with error ${error}`)
})
} catch (error) {
core.setFailed(`Action failed with error ${error}`)
}

0 comments on commit d802d1f

Please sign in to comment.