Skip to content

Commit

Permalink
Don't allow merging PR's which are being conflict checked (#19357)
Browse files Browse the repository at this point in the history
* Don't allow merging PR's which are being conflict checked

- When a PR is still being conflict checked, don't allow the PR to be
merged(the merge button could already be visible before e.g. a new
commit was pushed to the PR).
- Relevant(should prevent such issue from happening) #19352

Co-authored-by: delvh <dev.lh@web.de>
  • Loading branch information
Gusted and delvh authored Apr 20, 2022
1 parent f2229e0 commit 5e68fe7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions services/pull/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ var (
ErrUserNotAllowedToMerge = errors.New("user not allowed to merge")
ErrHasMerged = errors.New("has already been merged")
ErrIsWorkInProgress = errors.New("work in progress PRs cannot be merged")
ErrIsChecking = errors.New("cannot merge while conflict checking is in progress")
ErrNotMergableState = errors.New("not in mergeable state")
ErrDependenciesLeft = errors.New("is blocked by an open dependency")
)
Expand Down Expand Up @@ -88,6 +89,10 @@ func CheckPullMergable(ctx context.Context, doer *user_model.User, perm *models.
return ErrNotMergableState
}

if pr.IsChecking() {
return ErrIsChecking
}

if err := CheckPRReadyToMerge(ctx, pr, false); err != nil {
if models.IsErrDisallowedToMerge(err) {
if force {
Expand Down

0 comments on commit 5e68fe7

Please sign in to comment.