question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MAINT: Use protected branches to allow auto-merge

See original GitHub issue

A lot of times I want to “merge when green”. I propose we:

  1. Set main as a protected branch with all CIs required to pass (Require status checks to pass before merging)
  2. Uncheck the Include administrators box in the branch protection settings, which allows admins to override this
  3. 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:open
  • Created a year ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
larsonercommented, Jul 28, 2022

+1 for the merge when green

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 just admin. 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”.

0reactions
rgommerscommented, Jul 28, 2022

we can just normalise the use of Co-authored-by for reviewers.

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

About protected branches - GitHub Docs
You can enable branch restrictions if your repository is owned by an organization using GitHub Team or GitHub Enterprise Cloud. When you enable...
Read more >
Protected branches - GitLab Docs
Allowed to push is set to No one; Allowed to merge is set to Developers. You can create a protected branch by using...
Read more >
How to merge to a protected branch when Github Action ...
MERGE_LABELS : The labels that need to be present for a pull request to be merged (using MERGE_METHOD ). The default value is...
Read more >
Auto-merge in GitHub - Offtopic - Julia Programming Language
For the repository that you want to enable auto-merge: ... Go to “Settings → Branches” and enable branch protection for your main branch:....
Read more >
Automerge configuration and troubleshooting - Renovate Docs
Renovate's approach is to ensure that automerging branches are up-to-date with ... Let's say you have dependencies abc and xyz with upgrades, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found