Skip to content

Commit 8e2ec1e

Browse files
committed
Merge #145: Ignore duplicate build status webhooks
Approved-by: rudymatela Auto-deploy: false
2 parents 60bc5bd + 6017ef6 commit 8e2ec1e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/Logic.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ handleBuildStatusChanged buildSha newStatus = pure . Pr.updatePullRequests setBu
532532
setBuildStatus pr = case Pr.integrationStatus pr of
533533
-- If there is an integration candidate, and its integration sha matches that of the build,
534534
-- then update the build status for that pull request. Otherwise do nothing.
535-
Integrated candidateSha _ | candidateSha == buildSha ->
535+
Integrated candidateSha oldStatus | candidateSha == buildSha && newStatus /= oldStatus ->
536536
pr { Pr.integrationStatus = Integrated buildSha newStatus
537537
, Pr.needsFeedback = case newStatus of
538538
BuildPending (Just _) -> True

tests/Spec.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,6 +1719,7 @@ main = hspec $ do
17191719
, BuildStatusChanged (Sha "ef3") (Project.BuildSucceeded) -- PR#3 sha, ignored
17201720
, BuildStatusChanged (Sha "1ab") (Project.BuildPending Nothing) -- same status, ignored
17211721
, BuildStatusChanged (Sha "1ab") (Project.BuildPending (Just "example.com/1ab"))
1722+
, BuildStatusChanged (Sha "1ab") (Project.BuildPending (Just "example.com/1ab")) -- dup!
17221723
, CommentAdded (PullRequestId 1) "bot" "Waiting on CI job: example.com/1ab"
17231724
, CommentAdded (PullRequestId 3) "deckard" "@bot merge"
17241725
, CommentAdded (PullRequestId 3) "bot" "Pull request approved for merge behind 2 PRs."
@@ -1816,6 +1817,7 @@ main = hspec $ do
18161817
, CommentAdded (PullRequestId 8) "bot" "Waiting on CI job: example.com/2bc"
18171818
, BuildStatusChanged (Sha "36a") (Project.BuildSucceeded) -- arbitrary sha, ignored
18181819
, BuildStatusChanged (Sha "2bc") (Project.BuildFailed (Just "example.com/2bc")) -- PR#8
1820+
, BuildStatusChanged (Sha "2bc") (Project.BuildFailed (Just "example.com/2bc")) -- dup!
18191821
, CommentAdded (PullRequestId 8) "bot" "The build failed: example.com/2bc"
18201822
, CommentAdded (PullRequestId 7) "bot" "Rebased as 3cd, waiting for CI …"
18211823
, BuildStatusChanged (Sha "3cd") (Project.BuildPending (Just "example.com/3cd"))

0 commit comments

Comments
 (0)