-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Fix automerge will not work because of some events haven't been triggered #30780
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
f51af18
wip yES i Know theres is a cycle
6543 d145c26
fix & finish
6543 0dc9531
Use notify to trigger auto merge check
lunny e4e24d2
Remove unnecessary changes
lunny db6e278
Fix bugs
lunny a5d0708
Fix bug
lunny b208bde
Fix lint
lunny c1eac83
Add transaction for auto merge
lunny 3ec2753
Close git repo earlier
lunny b541467
Merge branch 'main' into lunny/fix_automerge
lunny ed361d2
Revert unnecessary change
lunny f5e4176
Revert unnecessary change
lunny 531e8db
Revert unnecessary change
lunny 9331ccd
Use better names for the automerge functions
lunny 8ecfb7d
Merge branch 'main' into lunny/fix_automerge
lunny 7d14dfc
Improve the comments
lunny 51e4888
Merge branch 'main' into lunny/fix_automerge
lunny 797236c
Add tests for pull request automerge when updating or commit status s…
lunny 5c0f00a
Fix test
lunny 44b306a
Fix test
lunny ee1aba3
Merge branch 'main' into lunny/fix_automerge
lunny 0d4cce7
Fix tests
lunny 438d880
Fix test
lunny fd8dda3
improvment
lunny 93c9739
Merge branch 'main' into lunny/fix_automerge
lunny deeea79
add trace for test
lunny 8331fa0
Add trace
lunny d9e8a42
add trace for test
lunny e447ec2
improve test
lunny 8d98ed5
Merge branch 'main' into lunny/fix_automerge
lunny a0adfd5
Fix test
lunny 1c202fa
Fix test
lunny 56914ed
Fix test
lunny 63b74a2
Merge branch 'main' into lunny/fix_automerge
lunny a5f0397
Use pull request directly when pull request review approved
lunny 9680940
Revert "Use pull request directly when pull request review approved"
lunny 894537c
Update services/automerge/automerge.go
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) | ||
| } |
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
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.