Skip to content

Commit

Permalink
Merge pull request lgtmco#5 from jonbodner/wait_all_status_checks
Browse files Browse the repository at this point in the history
Wait all status checks
  • Loading branch information
Jon Bodner authored and Jon Bodner committed May 16, 2016
2 parents d5043a7 + 0504929 commit 61c22e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion approval/approval.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func Register(name string, f Func) error {

func Lookup(name string) (Func, error) {
log.Debug("approvalMap has",approvalMap)
log.Debug("looking for '%s'\n",name)
log.Debugf("looking for '%s'\n",name)
f, ok := approvalMap[strings.ToLower(name)]
if !ok {
return nil, fmt.Errorf("Unknown Approval Algorithm %s", name)
Expand Down
13 changes: 12 additions & 1 deletion remote/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,17 @@ func (g *Github) GetPullRequestsForCommit(u *model.User, r *model.Repo, sha *str
log.Debug("current pr ==", *pr)
log.Debug("combined status ==",*status)

combinedState := *status.State
if combinedState == "success" {
log.Debug("overall status is success -- checking to see if all status checks returned success")
for _, v := range status.Statuses {
log.Debugf("status check %s returned %s",*v.Context, *v.State)
if *v.State != "success" {
log.Debugf("setting combined status check to %s",*v.State)
combinedState = *v.State
}
}
}
out[k] = model.PullRequest{
Issue: model.Issue{
Number: *v.Number,
Expand All @@ -449,7 +460,7 @@ func (g *Github) GetPullRequestsForCommit(u *model.User, r *model.Repo, sha *str
},
Branch: model.Branch {
Name: *pr.Head.Ref,
BranchStatus: *status.State,
BranchStatus: combinedState,
Mergeable: mergeable,

},
Expand Down

0 comments on commit 61c22e6

Please sign in to comment.