Skip to content

Commit b13b9d3

Browse files
zeripathjolheiser
authored andcommitted
Move Errored PRs out of StatusChecking (#9675) (#9726)
* 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> * Update services/pull/check.go Co-authored-by: John Olheiser <42128690+jolheiser@users.noreply.github.com>
1 parent 4072f28 commit b13b9d3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-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.
@@ -513,7 +514,7 @@ func (pr *PullRequest) apiFormat(e Engine) *api.PullRequest {
513514
}
514515

515516
if pr.Status != PullRequestStatusChecking {
516-
mergeable := pr.Status != PullRequestStatusConflict && !pr.IsWorkInProgress()
517+
mergeable := !(pr.Status == PullRequestStatusConflict || pr.Status == PullRequestStatusError) && !pr.IsWorkInProgress()
517518
apiPullRequest.Mergeable = mergeable
518519
}
519520
if pr.HasMerged {

services/pull/check.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,16 @@ 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+
if err := pr.UpdateCols("status"); err != nil {
205+
log.Error("Unable to update status of pr %d: %v", pr.ID, err)
206+
}
201207
continue
202208
}
203209
checkAndUpdateStatus(pr)

0 commit comments

Comments
 (0)