Skip to content

ci/review-policy: allow to use from other repos - #5573

Merged
rata merged 1 commit into
opencontainers:mainfrom
kolyshkin:review-policy-reusable
Oct 23, 2026
Merged

rata merged 1 commit into
opencontainers:mainfrom
kolyshkin:review-policy-reusable

Conversation

@kolyshkin

Copy link
Copy Markdown
Contributor

Make the review-policy workflow reusable (via workflow_call), so other
opencontainers repositories having the same merge rules can call it instead of
carrying a copy. The first user would be opencontainers/cgroups#91 (where this
was suggested).

A caller would look like this (pinned to a commit SHA, so the rules in the
calling repo can only change via its own governance change):

name: review-policy
on:
  pull_request_review:
    types: [submitted, edited, dismissed]
permissions: {}
jobs:
  review-policy:
    permissions:
      contents: read
      pull-requests: read
    uses: opencontainers/runc/.github/workflows/review-policy.yml@<sha>

The logic is unchanged, except CODEOWNERS is now also a governance file
(cgroups has one; runc does not, so this is a no-op here). The other
runc-specific bits (CHANGELOG.md, vendor/, merge_group) are harmless
for repos which don't have them.

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

Make the review-policy workflow reusable (via workflow_call), so other
opencontainers repositories with the same merge rules (such as
opencontainers/cgroups, see opencontainers/cgroups#91) can call it
instead of carrying a copy.

The calling repository gets the same logic, which is fine, since:
 - CHANGELOG.md and vendor/ exceptions are no-ops where there's no
   such file/directory;
 - the merge_group trigger is the caller's, and it's harmless when unused.

The only difference was CODEOWNERS, which cgroups treats as a governance
file. Add it here, too, as it does define who reviews what.

Document how to use it from another repository.

Signed-off-by: Kir Kolyshkin <[email protected]>
@kolyshkin
kolyshkin requested review from AkihiroSuda and rata October 23, 2026 08:21

@AkihiroSuda AkihiroSuda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@rata rata left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@rata
rata added this pull request to the merge queue Oct 23, 2026
Merged via the queue into opencontainers:main with commit c9232a3 Oct 23, 2026
96 of 97 checks passed
@thaJeztah

Copy link
Copy Markdown
Member

Wondering if we could use a opencontainers/.github repository for a more clear "shared resources" location.

kolyshkin added a commit to kolyshkin/oc-cgroups that referenced this pull request Oct 23, 2026
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.

The check itself is the runc one (see opencontainers/runc#5512), used
as a reusable workflow (made so in opencontainers/runc#5573), pinned to
a commit. Dependabot is told not to bump it, since a bump may change the
rules, so it should be a deliberate (and governance) change.

Signed-off-by: Kir Kolyshkin <[email protected]>
kolyshkin added a commit to kolyshkin/oc-cgroups that referenced this pull request Nov 3, 2026
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.

The check itself is the runc one (see opencontainers/runc#5512), used
as a reusable workflow (made so in opencontainers/runc#5573), pinned to
a commit. Dependabot is told not to bump it, since a bump may change the
rules, so it should be a deliberate (and governance) change.

Signed-off-by: Kir Kolyshkin <[email protected]>
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.

4 participants