Skip to content

Commit

Permalink
Add debug messages for "createLabel" and "addLabels" failures in "cre…
Browse files Browse the repository at this point in the history
…ateOrAddLabel"
  • Loading branch information
sogame committed Mar 16, 2020
1 parent b2cbbc9 commit 31a1961
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ x

<!-- Your comment below this -->

- Don't fail when using `createOrAddLabel` if label fails to be created or added - [@sogame]

<!-- Your comment above this -->

# 9.3.0
Expand Down
34 changes: 21 additions & 13 deletions source/platforms/github/GitHubUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,23 +203,31 @@ export const createOrAddLabel = (pr: GitHubPRDSL | undefined, api: GitHub) => as
// Create the label if it doesn't exist yet
if (!label) {
d("no label found, creating a new one for this repo")
await api.issues.createLabel({
owner: config.owner,
repo: config.repo,
name: labelConfig.name,
color: labelConfig.color,
description: labelConfig.description,
})
try {
await api.issues.createLabel({
owner: config.owner,
repo: config.repo,
name: labelConfig.name,
color: labelConfig.color,
description: labelConfig.description,
})
} catch (e) {
d("api.issues.createLabel gave an error", e)
}
}

d("adding a label to this pr")
// Then add the label
await api.issues.addLabels({
owner: config.owner,
repo: config.repo,
issue_number: config.id,
labels: [labelConfig.name],
})
try {
await api.issues.addLabels({
owner: config.owner,
repo: config.repo,
issue_number: config.id,
labels: [labelConfig.name],
})
} catch (e) {
d("api.issues.addLabels gave an error", e)
}
}

export default utils

0 comments on commit 31a1961

Please sign in to comment.