* 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>
This commit is contained in:
parent
4072f28e60
commit
b13b9d3dbd
2 changed files with 8 additions and 1 deletions
|
@ -35,6 +35,7 @@ const (
|
||||||
PullRequestStatusChecking
|
PullRequestStatusChecking
|
||||||
PullRequestStatusMergeable
|
PullRequestStatusMergeable
|
||||||
PullRequestStatusManuallyMerged
|
PullRequestStatusManuallyMerged
|
||||||
|
PullRequestStatusError
|
||||||
)
|
)
|
||||||
|
|
||||||
// PullRequest represents relation between pull request and repositories.
|
// PullRequest represents relation between pull request and repositories.
|
||||||
|
@ -513,7 +514,7 @@ func (pr *PullRequest) apiFormat(e Engine) *api.PullRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
if pr.Status != PullRequestStatusChecking {
|
if pr.Status != PullRequestStatusChecking {
|
||||||
mergeable := pr.Status != PullRequestStatusConflict && !pr.IsWorkInProgress()
|
mergeable := !(pr.Status == PullRequestStatusConflict || pr.Status == PullRequestStatusError) && !pr.IsWorkInProgress()
|
||||||
apiPullRequest.Mergeable = mergeable
|
apiPullRequest.Mergeable = mergeable
|
||||||
}
|
}
|
||||||
if pr.HasMerged {
|
if pr.HasMerged {
|
||||||
|
|
|
@ -194,10 +194,16 @@ func TestPullRequests(ctx context.Context) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("GetPullRequestByID[%s]: %v", prID, err)
|
log.Error("GetPullRequestByID[%s]: %v", prID, err)
|
||||||
continue
|
continue
|
||||||
|
} else if pr.Status != models.PullRequestStatusChecking {
|
||||||
|
continue
|
||||||
} else if manuallyMerged(pr) {
|
} else if manuallyMerged(pr) {
|
||||||
continue
|
continue
|
||||||
} else if err = TestPatch(pr); err != nil {
|
} else if err = TestPatch(pr); err != nil {
|
||||||
log.Error("testPatch[%d]: %v", pr.ID, err)
|
log.Error("testPatch[%d]: %v", pr.ID, err)
|
||||||
|
pr.Status = models.PullRequestStatusError
|
||||||
|
if err := pr.UpdateCols("status"); err != nil {
|
||||||
|
log.Error("Unable to update status of pr %d: %v", pr.ID, err)
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
checkAndUpdateStatus(pr)
|
checkAndUpdateStatus(pr)
|
||||||
|
|
Reference in a new issue