Skip to content

Commit

Permalink
Use the first status
Browse files Browse the repository at this point in the history
Previously it would use any commit status but the same context status
can now appear multiple times and the first entry is the most current
status, so we should only compare against that.
  • Loading branch information
rwinch committed Nov 3, 2022
1 parent ca59813 commit 8a10a23
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ private ContextCommitStatus createCommitStatusIfNecessary(PullRequestId pullRequ
status.setUrl(commitStatus.getUrl());
status.setTargetUrl(status.getUrl());
List<ContextCommitStatus> statuses = commitService.getContextStatuses(pullRequestId.getRepositoryId(), commitStatus.getSha());
if (!statuses.stream().anyMatch(s -> matches(status, s))) {
ContextCommitStatus firstContextStatus = statuses.stream().filter(s -> s.getContext().equals(status.getContext())).findFirst().orElse(null);
if (firstContextStatus == null || !matches(status, firstContextStatus)) {
commitService.createStatus(pullRequestId.getRepositoryId(), commitStatus.getSha(), status);
}
return status;
Expand Down

0 comments on commit 8a10a23

Please sign in to comment.