Skip to content

Commit 61c22e6

Browse files
Jon BodnerJon Bodner
Jon Bodner
authored and
Jon Bodner
committed
Merge pull request lgtmco#5 from jonbodner/wait_all_status_checks
Wait all status checks
2 parents d5043a7 + 0504929 commit 61c22e6

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

approval/approval.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func Register(name string, f Func) error {
2525

2626
func Lookup(name string) (Func, error) {
2727
log.Debug("approvalMap has",approvalMap)
28-
log.Debug("looking for '%s'\n",name)
28+
log.Debugf("looking for '%s'\n",name)
2929
f, ok := approvalMap[strings.ToLower(name)]
3030
if !ok {
3131
return nil, fmt.Errorf("Unknown Approval Algorithm %s", name)

remote/github/github.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,17 @@ func (g *Github) GetPullRequestsForCommit(u *model.User, r *model.Repo, sha *str
441441
log.Debug("current pr ==", *pr)
442442
log.Debug("combined status ==",*status)
443443

444+
combinedState := *status.State
445+
if combinedState == "success" {
446+
log.Debug("overall status is success -- checking to see if all status checks returned success")
447+
for _, v := range status.Statuses {
448+
log.Debugf("status check %s returned %s",*v.Context, *v.State)
449+
if *v.State != "success" {
450+
log.Debugf("setting combined status check to %s",*v.State)
451+
combinedState = *v.State
452+
}
453+
}
454+
}
444455
out[k] = model.PullRequest{
445456
Issue: model.Issue{
446457
Number: *v.Number,
@@ -449,7 +460,7 @@ func (g *Github) GetPullRequestsForCommit(u *model.User, r *model.Repo, sha *str
449460
},
450461
Branch: model.Branch {
451462
Name: *pr.Head.Ref,
452-
BranchStatus: *status.State,
463+
BranchStatus: combinedState,
453464
Mergeable: mergeable,
454465

455466
},

0 commit comments

Comments
 (0)