Skip to content

Commit

Permalink
fix: catch label creation error
Browse files Browse the repository at this point in the history
  • Loading branch information
chabou committed Jan 25, 2021
1 parent 67b1a27 commit efdef7c
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,23 @@ async function addLabels(prNumber: number, labels: Label[]): Promise<void> {
const remoteLabel = existingLabels.find(
label_ => label.name === label_.name
)
if (!remoteLabel && label.name) {
const response = await octokit.issues.createLabel({
owner,
repo,
name: label.name,
color: label.color
})
core.info(JSON.stringify(response))
if (!remoteLabel) {
core.info(
`Creating label ${label.name} (not found in ${JSON.stringify(
existingLabels
)}`
)
try {
const response = await octokit.issues.createLabel({
owner,
repo,
name: label.name,
color: label.color
})
core.info(JSON.stringify(response))
} catch (e) {
core.warning(`Creation failed: ${e.message}`)
}
}
}

Expand Down

0 comments on commit efdef7c

Please sign in to comment.