Skip to content

Require status checks to pass before merging (for auto-merge, no policy change) #148

@andres-erbsen

Description

@andres-erbsen

I would like to use the "Enable auto-merge" feature of GitHub, to mark PRs to be merged as soon as CI passes. I have used it extensively in my own repositories and found it to be reliable, and a good way to reduce friction for contributing. However, this feature is limited to branches with a branch-protection rule preventing merging without a passed check:

The option to enable auto-merge is shown only on pull requests that cannot be merged immediately. For example, when a branch protection rule enforces "Require pull request reviews before merging" or "Require status checks to pass before merging" and these conditions are not yet met. For more information, see Managing a branch protection rule.

Further, branch protection rules must explicitly enumerate checks that pass, which seems impractical given the current fine-grained check granularity. If that granularity is to stay, I believe the actual configuration would have to be as follows:

  1. Add a job that fails unless all other jobs succeed (depending on the other jobs is not good enough because dependency failures cause "skipped", not "failed"). There's a marketplace action called "alls-green" that may be useful for inspiration.
  2. Configure a branch protection rule for master to require CI checks to pass before merging. This way not-yet-passing PRs can be set to merge once CI passes.
  3. Enable the "bypass branch protections" for all roles with the merge permission. This way, non-passing PRs can still be merged.

I would be happy to try hand at configuring this myself if I had the requisite permissions. If this is not desired, I'd be happy to help out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions