Skip to content

Commit

Permalink
Move Errored PRs out of StatusChecking (go-gitea#9675)
Browse files Browse the repository at this point in the history
* Set Errored PRs out of StatusChecking

* Ensure that api status is correctly set too

* Update models/pull.go

Co-Authored-By: John Olheiser <[email protected]>

Co-authored-by: John Olheiser <[email protected]>
  • Loading branch information
zeripath and jolheiser committed Jan 12, 2020
1 parent fec3544 commit 50eb5dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion models/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const (
PullRequestStatusChecking
PullRequestStatusMergeable
PullRequestStatusManuallyMerged
PullRequestStatusError
)

// PullRequest represents relation between pull request and repositories.
Expand Down Expand Up @@ -513,7 +514,7 @@ func (pr *PullRequest) apiFormat(e Engine) *api.PullRequest {
}

if pr.Status != PullRequestStatusChecking {
mergeable := pr.Status != PullRequestStatusConflict && !pr.IsWorkInProgress()
mergeable := !(pr.Status == PullRequestStatusConflict || pr.Status == PullRequestStatusError) && !pr.IsWorkInProgress()
apiPullRequest.Mergeable = mergeable
}
if pr.HasMerged {
Expand Down
4 changes: 4 additions & 0 deletions services/pull/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,14 @@ func TestPullRequests(ctx context.Context) {
if err != nil {
log.Error("GetPullRequestByID[%s]: %v", prID, err)
continue
} else if pr.Status != models.PullRequestStatusChecking {
continue
} else if manuallyMerged(pr) {
continue
} else if err = TestPatch(pr); err != nil {
log.Error("testPatch[%d]: %v", pr.ID, err)
pr.Status = models.PullRequestStatusError
pr.UpdateCols("status")
continue
}
checkAndUpdateStatus(pr)
Expand Down

0 comments on commit 50eb5dd

Please sign in to comment.