Skip to content

Commit 17b844a

Browse files
zeripathjolheiser
authored andcommitted
Move Errored PRs out of StatusChecking (#9675)
* Set Errored PRs out of StatusChecking * Ensure that api status is correctly set too * Update models/pull.go Co-Authored-By: John Olheiser <42128690+jolheiser@users.noreply.github.com> Co-authored-by: John Olheiser <42128690+jolheiser@users.noreply.github.com>
1 parent 6c46a56 commit 17b844a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

models/pull.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const (
3535
PullRequestStatusChecking
3636
PullRequestStatusMergeable
3737
PullRequestStatusManuallyMerged
38+
PullRequestStatusError
3839
)
3940

4041
// PullRequest represents relation between pull request and repositories.
@@ -517,7 +518,7 @@ func (pr *PullRequest) apiFormat(e Engine) *api.PullRequest {
517518
}
518519

519520
if pr.Status != PullRequestStatusChecking {
520-
mergeable := pr.Status != PullRequestStatusConflict && !pr.IsWorkInProgress()
521+
mergeable := !(pr.Status == PullRequestStatusConflict || pr.Status == PullRequestStatusError) && !pr.IsWorkInProgress()
521522
apiPullRequest.Mergeable = mergeable
522523
}
523524
if pr.HasMerged {

services/pull/check.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,14 @@ func TestPullRequests(ctx context.Context) {
194194
if err != nil {
195195
log.Error("GetPullRequestByID[%s]: %v", prID, err)
196196
continue
197+
} else if pr.Status != models.PullRequestStatusChecking {
198+
continue
197199
} else if manuallyMerged(pr) {
198200
continue
199201
} else if err = TestPatch(pr); err != nil {
200202
log.Error("testPatch[%d]: %v", pr.ID, err)
203+
pr.Status = models.PullRequestStatusError
204+
pr.UpdateCols("status")
201205
continue
202206
}
203207
checkAndUpdateStatus(pr)

0 commit comments

Comments
 (0)