Skip to content

Relax PR merge rules, enforce them via CI - #91

Open
kolyshkin wants to merge 2 commits into
opencontainers:mainfrom
kolyshkin:review-policy
Open

kolyshkin wants to merge 2 commits into
opencontainers:mainfrom
kolyshkin:review-policy

Conversation

@kolyshkin

Copy link
Copy Markdown
Contributor

This is the same as opencontainers/runc#5512 (see there for the rationale
and discussion), with the only differences being local specifics:

  • there is no vendor/ here, so all changed lines count towards the
    large change threshold;
  • there is no CHANGELOG.md, so README.md is the only top-level *.md
    file which is not a governance file;
  • CODEOWNERS is added to governance files;
  • the existing MAINTAINERS_GUIDE.md wording is merged with the new text.

The follow-up opencontainers/runc#5563 (merge_group support) is not
needed here, as this repo does not use the merge queue.

After merging

A repo admin needs to update the main branch protection:

  1. Add review-policy (from GitHub Actions) as a required status check.
  2. Lower the required number of approvals from 2 to 1.

Once the check is required, open PRs won't have it until someone reviews
them (a comment-only review is enough).

Note this is a governance change, so it needs two LGTMs.

Many pull requests stay open for weeks waiting for a second review,
which slows down development considerably.

Spell out the merge rules, and relax them for maintainers: a pull
request authored by a maintainer can be merged with a single LGTM
from another maintainer, provided it has been open for review for at
least 7 days (14 days for large changes, i.e. more than 100 lines),
so that other maintainers had a chance to object.

Also, allow routine pull requests (opened by Dependabot, or only
changing documentation and/or CI configuration) to be merged with a
single LGTM.

Neither of the above applies to governance changes, i.e. changes to
the project rules (such as this document) or their enforcement, which
always require two LGTMs.

While at it, clarify that:
 - an LGTM is a pull request approval;
 - a maintainer requesting changes blocks the merge.

This is the same as done in runc (see opencontainers/runc#5512).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Add a check enforcing the pull request merge rules from
MAINTAINERS_GUIDE.md, to be used as a required status check (in
addition to the GitHub's required number of approvals, which can not
depend on who the author is, and also counts approvals from anyone
having write access, not just from current maintainers).

The check is a pull_request_review workflow with a read-only token,
which evaluates the current state of the pull request using the GitHub
API. No other triggers are used, since branch protection requires the
latest run for each event type to pass, so a failed run triggered by,
say, a push would keep blocking the merge after a review fixes it.

As a result, the check needs a review (a comment-only one is fine) to
be run after a push, and it needs to be re-run manually once a review
period is over.

Note that since the workflow runs from the pull request, a pull request
can change it. This is the price for not using privileged triggers
(pull_request_target or workflow_run) and write permissions. To
mitigate, the workflow is a governance file (so changing it requires
two LGTMs), and GitHub's own required approval stays as a backstop.

This is a copy of the runc check (see opencontainers/runc#5512),
adapted for this repo (no vendor/ and CHANGELOG.md, but CODEOWNERS).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin
kolyshkin requested a review from a team as a code owner October 19, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant