multi-gitter icon indicating copy to clipboard operation
multi-gitter copied to clipboard

Add bulk pull request approval support

Open Sam13 opened this issue 2 years ago • 6 comments

Additional / optional pull request approval support would be nice for the merge command.

When you have e.g. GitHub branch protections which do not allow administrator bypassing you cannot bulk merge the changes you created with the run command..

Sam13 avatar Oct 21 '22 10:10 Sam13

Could you provide more info on the problem?

My understanding is that you have approval requirements on repositories, but not administrator bypassing. What addition to the merge command would resolve this?

lindell avatar Oct 21 '22 12:10 lindell

Yes. You cannot merge any PR then when not approved.

GitHub API will provide the following error message if you try to do so:

At least 1 approving review is required by reviewers with write access.

To enable merge, a review with approval review action (event=APPROVE) is required. The GitHub API is documented here: https://docs.github.com/en/rest/pulls/reviews#create-a-review-for-a-pull-request https://docs.github.com/en/graphql/reference/input-objects#addpullrequestreviewinput

I think your GO GitHub library supports that: https://github.com/google/go-github/blob/master/github/pulls_reviews.go

I suggest to make this approval an optional option maybe with some additional review comments which can be provided?

Sam13 avatar Oct 21 '22 13:10 Sam13

I don't think you can approve your own PR?

Even if you could, this would only work when exactly one required reviewer is set, anything more than that would not work.

lindell avatar Oct 22 '22 13:10 lindell

I don't think you can approve your own PR?

No you can't. Sorry for being unprecise in my initial description.

This feature would be useful e.g. to bulk approve and merge Dependabot PRs or PRs that somebody else created (with multi-gitter). If you have the policy that administrators cannot bypass branch protection and use multi-gitter, you'll end up with hundreds of pull request which need to be manually approved and merged.

Even if you could, this would only work when exactly one required reviewer is set, anything more than that would not work.

Valid point, then maybe approval should be a separate command?

Sam13 avatar Oct 23 '22 09:10 Sam13

This feature would be useful e.g. to bulk approve and merge Dependabot PRs or PRs that somebody else created (with multi-gitter).

Even though the merge/close/status commands can be used on PRs not created by multi-gitter, it's not really the use case. If users use those commands for it, that's fine, but changes will not be made because of it.

then maybe approval should be a separate command?

I think this is the solution if one were to be implemented 🙂 But currently, I think this is a special case since the setting, that not even administrators should be able to override a merge indicate that it should indeed not be overridden in any way. And creating a new sub command for this special case is today not relevant. But I'm open to having my mind changed if a lot of people have this use case. I will therefore leave this open and allow others to comment if they have this use case.

lindell avatar Oct 23 '22 13:10 lindell

Hey @lindell is there a plan to add this feature soon ? it's a big time-saver :D

I can see there's already a PR for that #332

MHAbido avatar Aug 30 '23 12:08 MHAbido