aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-01-12 19:52:40 +0000
committerAntoine GIRARD <sapk@users.noreply.github.com>2020-01-12 20:52:40 +0100
commitb13b9d3dbd8447e2c4949bd2664615471755b68b (patch)
treebe4327b7eb045ce90ac4656388f52fd32f20a7ee
parent4072f28e60dc6bc6ae637e68e31392d28d5cf3f3 (diff)
downloadgitea-b13b9d3dbd8447e2c4949bd2664615471755b68b.tar.gz
gitea-b13b9d3dbd8447e2c4949bd2664615471755b68b.zip
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>
-rw-r--r--models/pull.go3
-rw-r--r--services/pull/check.go6
2 files changed, 8 insertions, 1 deletions
diff --git a/models/pull.go b/models/pull.go
index f86892cbfc..94cb2a2a03 100644
--- a/models/pull.go
+++ b/models/pull.go
@@ -35,6 +35,7 @@ const (
PullRequestStatusChecking
PullRequestStatusMergeable
PullRequestStatusManuallyMerged
+ PullRequestStatusError
)
// PullRequest represents relation between pull request and repositories.
@@ -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 {
diff --git a/services/pull/check.go b/services/pull/check.go
index 74185b6815..055403d0df 100644
--- a/services/pull/check.go
+++ b/services/pull/check.go
@@ -194,10 +194,16 @@ 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
+ if err := pr.UpdateCols("status"); err != nil {
+ log.Error("Unable to update status of pr %d: %v", pr.ID, err)
+ }
continue
}
checkAndUpdateStatus(pr)