You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replaces GitHub's native "required reviews" with a custom approval-gate check
Adds bors-style @delegate support, allowing maintainers to delegate PR approval rights to non-maintainers for a specific PR
This enables "drive-by contributions" where trusted community members can effectively approve PRs on behalf of maintainers.
Motivation
GitHub's native branch protection has a fundamental limitation: reviews from non-maintainers don't count toward required review counts. There's no API to make a non-maintainer's approval "count."
This creates friction for:
Drive-by contributions: A trusted community member reviews a PR thoroughly but their approval doesn't "count"
Domain expertise: Someone with deep knowledge of a specific area (but not a maintainer) can't formally approve changes
Reducing maintainer burden: Maintainers must personally approve every PR even when a trusted reviewer has already done thorough review
The bors @delegate pattern solves this: a maintainer vouches for a specific reviewer on a specific PR, temporarily granting them approval authority.
Single source of truth for org policy in bootc-dev/infra
Automatic sync via existing sync-common mechanism
Avoids re-running CI:
ci.yml only triggers on pull_request (code changes)
org-required-checks.yml triggers on comments/reviews too, but only runs lightweight approval check
Future extensibility: The org-required-checks workflow can incorporate other org-wide checks (OpenSSF scorecard, DCO, license checks, etc.) into the same sentinel pattern.
Implementation Components
1. Org-wide Ruleset
Configure at org level (Settings → Repository → Rulesets):
Target: All repositories
Target branches: Default branch
Rule: Require status checks to pass
required-checks (repo-specific CI sentinel)
org-required-checks (org-wide policy sentinel)
Rule: Required reviews = 0 (or disable - we handle this ourselves)
2. Org-wide Workflow: org-required-checks.yml
# common/.github/workflows/org-required-checks.ymlname: Org Required Checkson:
pull_request:
types: [opened, synchronize, reopened]pull_request_review:
types: [submitted, dismissed]issue_comment:
types: [created, edited, deleted]jobs:
approval-gate:
runs-on: ubuntu-latest# Only run on PRs (issue_comment fires for issues too)if: github.event.pull_request || github.event.issue.pull_requeststeps:
- uses: bootc-dev/infra/actions/approval-gate@mainwith:
token: ${{ secrets.GITHUB_TOKEN }}# Future: other org-wide checks can be added here# Sentinel joborg-required-checks:
if: always()needs: [approval-gate]runs-on: ubuntu-lateststeps:
- run: exit 1if: needs.approval-gate.result != 'success'
Enable maintainers to temporarily empower non-maintainers to approve specific PRs, following rust-lang/bors's delegation model.
GitHub's native required reviews only counts approvals from users with write access. We replace this with a custom approval-gate status check implementing our own approval logic, including delegation.
Commands
@delegate+ - delegate to the PR author
@delegate=@user or @delegate=@user1,@user2 - delegate to specific user(s)
@undelegate - revoke
Architecture
flowchart TB
subgraph ruleset["Org-wide Ruleset"]
rc["required-checks<br/>(repo-specific CI)"]
orc["org-required-checks<br/>(approval-gate + future checks)"]
end
subgraph repo["Each Repo"]
ci["ci.yml<br/>on: pull_request"]
org["org-required-checks.yml<br/>on: pull_request, review, comment"]
end
ci --> rc
org --> orc
Loading
org-required-checks.yml lives in common/.github/workflows/ and syncs to all repos. Triggers on pull_request, pull_request_review, and issue_comment to run the approval check.
Summary
Implement a custom review gating system that:
approval-gatecheck@delegatesupport, allowing maintainers to delegate PR approval rights to non-maintainers for a specific PRThis enables "drive-by contributions" where trusted community members can effectively approve PRs on behalf of maintainers.
Motivation
GitHub's native branch protection has a fundamental limitation: reviews from non-maintainers don't count toward required review counts. There's no API to make a non-maintainer's approval "count."
This creates friction for:
The bors
@delegatepattern solves this: a maintainer vouches for a specific reviewer on a specific PR, temporarily granting them approval authority.Proposed Behavior
Delegation Commands
/delegate+/delegate=@username/delegate=@user1,@user2/undelegateWorkflow
/delegate=@contributorapproval-gate(ororg-required-checks) status turns greenKey Properties
/undelegateTechnical Approach
Core Idea: Replace Native Reviews with Custom Check
Instead of relying on GitHub's "Require X approving reviews" ruleset, we:
approval-gatestatus check that implements our own approval logicThis gives us full control over what constitutes a valid approval.
Architecture: Org-wide vs Repo-specific Checks
Why This Architecture?
Separation of concerns:
required-checks= repo-specific (build, test, lint - varies per repo)org-required-checks= org-wide policy (same for all repos)Benefits:
bootc-dev/infrasync-commonmechanismAvoids re-running CI:
ci.ymlonly triggers onpull_request(code changes)org-required-checks.ymltriggers on comments/reviews too, but only runs lightweight approval checkFuture extensibility: The
org-required-checksworkflow can incorporate other org-wide checks (OpenSSF scorecard, DCO, license checks, etc.) into the same sentinel pattern.Implementation Components
1. Org-wide Ruleset
Configure at org level (Settings → Repository → Rulesets):
required-checks(repo-specific CI sentinel)org-required-checks(org-wide policy sentinel)2. Org-wide Workflow:
org-required-checks.yml3. Reusable Action:
bootc-dev/infra/actions/approval-gateDetecting Maintainers
Use the Collaborators API to check for users with
push(write) oradminpermission:This matches GitHub's native permission model and requires no configuration.
State Management
No external state needed - the action parses PR state on each run:
@delegatecommands from maintainersStateless and idempotent.
Event Handling
pull_request.openedpull_request.synchronizepull_request_review.submittedpull_request_review.dismissedissue_comment.created@delegatecommandsissue_comment.editedissue_comment.deletedRollout Plan
approval-gateaction inbootc-dev/infra/actions/org-required-checks.ymlworkflow incommon/.github/workflows/bootc-dev/infrareposync-commonrequired-checksandorg-required-checksSecurity Considerations
@delegatecommands visible in PR comment history@undelegateor deleting the comment removes delegationAlternatives Considered
Open Questions
Future Work
The
org-required-checksworkflow provides a natural place to add other org-wide checks:openssf-scorecard-gate.yml)These would be added as additional jobs in the workflow, with the sentinel job aggregating them.
Prior Art
required-checksRelated Work
rebase.ymlworkflow patternsync-commonmechanismbootc-dev Botidentity for comments (if we add confirmation replies)toolbx(rhel-toolbox-stream10) ~/src/github/bootc-dev/infra> opencode -c
^[[<51;244;38M
toolbx(rhel-toolbox-stream10) ~/src/github/bootc-dev/infra> cat /tmp/review.md
Custom review gating with
@delegatesupportSummary
Enable maintainers to temporarily empower non-maintainers to approve specific PRs, following rust-lang/bors's delegation model.
GitHub's native required reviews only counts approvals from users with write access. We replace this with a custom
approval-gatestatus check implementing our own approval logic, including delegation.Commands
@delegate+- delegate to the PR author@delegate=@useror@delegate=@user1,@user2- delegate to specific user(s)@undelegate- revokeArchitecture
flowchart TB subgraph ruleset["Org-wide Ruleset"] rc["required-checks<br/>(repo-specific CI)"] orc["org-required-checks<br/>(approval-gate + future checks)"] end subgraph repo["Each Repo"] ci["ci.yml<br/>on: pull_request"] org["org-required-checks.yml<br/>on: pull_request, review, comment"] end ci --> rc org --> orcorg-required-checks.ymllives incommon/.github/workflows/and syncs to all repos. Triggers onpull_request,pull_request_review, andissue_commentto run the approval check.Workflow
The approval-gate action
Stateless - parses PR state on each run:
Maintainers detected via collaborators API (
permission=push).Rollout
approval-gateaction inbootc-dev/infra/actions/org-required-checks.ymlincommon/.github/workflows/Open questions
@delegate=@uservs@bot delegate=@uservs/delegate @user?Prior art
ci.ymlsentinel job pattern