-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Also run automerge check after pull review #25741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
276c7a9
wip yES i Know theres is a cycle
6543 798a194
fix & finish
6543 7ba4d00
Use notify to trigger auto merge check
lunny 5ff6888
Remove unnecessary changes
lunny 9b16eda
Fix bugs
lunny acd2a9b
Fix bug
lunny ec2f717
Fix lint
lunny db4113e
Add transaction for auto merge
lunny File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2024 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package automerge | ||
|
||
import ( | ||
"context" | ||
|
||
issues_model "code.gitea.io/gitea/models/issues" | ||
user_model "code.gitea.io/gitea/models/user" | ||
"code.gitea.io/gitea/modules/log" | ||
notify_service "code.gitea.io/gitea/services/notify" | ||
) | ||
|
||
type automergeNotifier struct { | ||
notify_service.NullNotifier | ||
} | ||
|
||
var _ notify_service.Notifier = &automergeNotifier{} | ||
|
||
// NewNotifier create a new automergeNotifier notifier | ||
func NewNotifier() notify_service.Notifier { | ||
return &automergeNotifier{} | ||
} | ||
|
||
func (n *automergeNotifier) PullRequestReview(ctx context.Context, pr *issues_model.PullRequest, review *issues_model.Review, comment *issues_model.Comment, mentions []*user_model.User) { | ||
// as a missing / blocking reviews could have blocked a pending automerge let's recheck | ||
if review.Type == issues_model.ReviewTypeApprove { | ||
if err := StartPullRequestAutoMergeCheckBySHA(ctx, review.CommitID, pr.BaseRepo); err != nil { | ||
log.Error("StartPullRequestAutoMergeCheckBySHA: %v", err) | ||
} | ||
} | ||
} | ||
|
||
func (n *automergeNotifier) PullReviewDismiss(ctx context.Context, doer *user_model.User, review *issues_model.Review, comment *issues_model.Comment) { | ||
if err := review.LoadIssue(ctx); err != nil { | ||
log.Error("LoadIssue: %v", err) | ||
return | ||
} | ||
if err := review.Issue.LoadPullRequest(ctx); err != nil { | ||
log.Error("LoadPullRequest: %v", err) | ||
return | ||
} | ||
// as reviews could have blocked a pending automerge let's recheck | ||
StartPullRequestAutoMergeCheck(ctx, review.Issue.PullRequest) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.