-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Auto merge pull requests when all checks succeeded via API #9307
Conversation
I'm not sure why the vendor check fails, it passes on my local machine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've only given it a quick look.
BTW, is it possible that you're still using go 1.11 instead of 1.13?
I'm on go 1.12.9, should be fine. I'll try upgrading to see if the problem still exists. |
Looks like |
cc1e17b
to
ac0c44a
Compare
I'm not sure where all of these commits are coming from, looks like my local gitea master was outdated... |
This seems to be ready for review now. |
This comment was marked as outdated.
This comment was marked as outdated.
Tests are now passing, so ready for review (again). |
Should I try to remove the unneeded commits? It might not be necessary since we're squash merging anyway and there are no unrelated changes in this pr. |
@kolaente can you add some tests? |
conflicts :D |
Please resolve the conflicts. |
7460ecc
to
a61f329
Compare
And now tests are failing again... I guess I'll fix those first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are just my personal opinions, not necessarily correct. Thanks
I think it would be fun if you can add event comment on the pr time-line when add or remove a auto-merge task, which is similar with Assign , Labels, review .., Thanks |
Sounds like a good idea. |
500 error while viewing pull request.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: delvh <dev.lh@web.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping bot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving to make lgtm work
We can just merge this with administrator permission after CI PASS. |
307 commits and 2½years (~76025940sec) later 🎉 |
Wow awesome! Thanks @6543 and everyone else who picked this up and finished it! |
* giteaofficial/main: Delete related PullAutoMerge and ReviewState on User/Repo Deletion (go-gitea#19649) Allow custom default merge message with .gitea/default_merge_message/<merge_style>_TEMPLATE.md (go-gitea#18177) Allow to mark files in a PR as viewed (go-gitea#19007) Auto merge pull requests when all checks succeeded via API (go-gitea#9307) Hide private repositories in packages (go-gitea#19584) Only show accessible teams in dashboard dropdown list (go-gitea#19642) prevent double click new issue/pull/comment button (go-gitea#16157) Improve reviewing PR UX (go-gitea#19612) [skip ci] Updated translations via Crowdin Add Changelog v1.16.7 (go-gitea#19575) (go-gitea#19644) Set safe dir for git operations in .drone.yml CI (go-gitea#19641) Add missing `sorting` column in `project_issue` table (go-gitea#19635)
Really great work @6543 and all the other contributer! |
(split out) WebUI part is ready: #19648 |
This adds the functionality to auto merge a pull request, once all status checks succeed.
To achieve this, it schedules a pr to merge when a user request a merge via API and set
merge_when_checks_succeed
to true.On every status check update, if there are scheduled merge requests for this pull and that pull pass all merge requirements, they get merged.
I created fake statuses for testing by running
curl -X POST "http://localhost:3000/api/v1/repos/kolaente/testing/statuses/ccd425c09136a411236830785c41afdc172e8208" -H "accept: application/json" -H "authorization: Basic a29sYWVudGU6anVwMjAwMA==" -H "Content-Type: application/json" -d '{"context": "test/context", "description": "description", "state": "pending", "target_url": "http://localhost"}' | jq
TODO
{User} scheduled this pr to auto-merge
routers/repo/pull.go:676
to prevent scheduling a pr for merging after all checks already passed.services/automerge/pull_auto_merge.go:89
pull_service.Merge() need a lock-> move it into won pull (PullService lock via pullID #19520)Fix UI glitch to Create AutoMerge-> new issue ... new pull Auto merge pull requests when all checks succeeded via WebUI #19621Optional TODOs
close #3905