MAINT: Use protected branches to allow auto-merge
See original GitHub issueA lot of times I want to “merge when green”. I propose we:
- Set
main
as a protected branch with all CIs required to pass (Require status checks to pass before merging
) - Uncheck the
Include administrators
box in the branch protection settings, which allows admins to override this - Turn on the
Allow auto-merge
in the repo general settings
This would allow me to click “Squash and merge when ready” in https://github.com/scipy/scipy/pull/16709 for example. I’ve used it in a couple of other repos for a couple of weeks and found it pretty useful so far.
My only hesitation is that it seems like there are hours-days where one or two CIs are unreliable or broken. (Ideally CIs would not break like this at all, but given the complexity and broad testing scope of SciPy I guess it’s inevitable.) In this case, we would either need to 1) remove these from the branch protection rules for a while so that they can be ignored (annoying), or 2) an administrator would have to merge in these cases (there is a checkbox admins can use in a given PR to say “ignore the requirements and merge anyway”).
This would increase burden on admins – does it seem worth it in terms of the auto-merge tradeoff? It looks like there are 5 people listed as admins who have been active lately (@tylerjereddy, @ev-br, @rgommers, @stefanv, and me) so I guess the burden would mostly fall to us in the “hey admins, there is a broken CI we should ignore, please merge for us” case, so let me know what you think.
These are also just easily toggled checkboxes, so we could try it for a couple of weeks and easily disable it if it’s counterproductive.
Issue Analytics
- State:
- Created a year ago
- Comments:9 (9 by maintainers)
At least to do it with the simple GitHub repo settings, you have to enable “only allow merge when green (but admins can be an exception)” to have the “merge when requirements met” option on PRs. (Or at least for the requirements to be meaningful in the sense we’re talking about, i.e., when green)
There are other ways to do it, like allowing an
automerge
label and adding a bot, or browser extensions. But it would be nice to be able to use the GH interface.Maybe we should wait until they allow adding exceptions / allowing overrides for different privilege levels like
write
instead of justadmin
. Then there wouldn’t really be a downside to the GH approach because you can just click a box in the PR saying “yes I really want to ignore the CIs”.Please don’t do that, review=review and authoring=authoring, they’re separate and we typically want a reviewer who is not a (co-)author of the code being merged. There’s always some grey zone, if a reviewer starts pushing commits with nontrivial content then they become a co-author; but a few style changes right before merge does not.