Skip to content

Commit

Permalink
Merge pull request #705 from sgtcoolguy/bitbucket-pending
Browse files Browse the repository at this point in the history
Fix handling of 'pending' status for BitBucket's updateStatus()
  • Loading branch information
orta authored Nov 5, 2018
2 parents 3419b64 + c931a5e commit 1e34f3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

## Master

- Fix handling a `"pending"` status update properly using Bitbucket API - [@sgtcoolguy][]
- Fix #614 - Posting status updates to Github using issue workflow broken - [@sgtcoolguy][]
- Fix vertical alignment in GitHub issue template - [@patrickkempff][]

Expand Down
6 changes: 5 additions & 1 deletion source/platforms/BitBucketServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ export class BitBucketServer implements Platform {
updateStatus = async (passed: boolean | "pending", message: string, url?: string): Promise<boolean> => {
const pr = await this.api.getPullRequestInfo()
const { latestCommit } = pr.fromRef
let state = passed ? "SUCCESSFUL" : "FAILED"
if (passed === "pending") {
state = "INPROGRESS"
}
try {
await this.api.postBuildStatus(latestCommit, {
state: passed ? "SUCCESSFUL" : "FAILED",
state: state,
key: "danger.systems",
name: process.env["PERIL_INTEGRATION_ID"] ? "Peril" : "Danger",
url: url || "http://danger.systems/js",
Expand Down

0 comments on commit 1e34f3b

Please sign in to comment.