Repository navigation
Declare the Merge-Bot's Actions Event Policy in repo-config - #4637
Conversation
GitHub blocks pull_request_target workflows on a public repository with no Actions event policy of its own, which fails the merge-bot workflow at startup. configure.sh now declares the policy in actions-policies.json, applies it by name on every repository, and checks it, warning on an undeclared live policy. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Apply and check matched a declared policy by the first live entry of its name, so a duplicate left the judged policy to list order. The live read now refuses that case and names the policy to delete by hand. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Read back only a policy a write touched, by the id the POST response or the listed id gave, so a create never depends on the list catching up and a match makes no read-back. Capture each write's response instead of printing it, add one name-to-id helper, and add offline tests for the payload contract, the live read, apply, and check. Co-Authored-By: Claude Opus 5.5 <[email protected]>
read_back_settles now hands its trailing arguments to the read function, so apply reads back one policy by id with no global or wrapper. Drop the redundant empty-id check after the POST, correct the README on what the policy list carries, and test the apply pre-flight and the argument pass-through. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 48 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
🟡 Changes recommended
A moderate active issue remains because the paginated Actions policies response is not fully aggregated, causing valid repositories with more than 30 policies to fail in both apply and check modes.
1 open issue
What changed in this PR
Adds fleet-wide GitHub Actions event-policy management so the merge-bot can use pull_request_target safely.
Changes:
- Declares the merge-bot policy and implements idempotent apply/check handling.
- Adds offline tests for validation, reads, writes, read-back, and wiring.
- Updates repository configuration, operations, and audit documentation.
| File | Description |
|---|---|
| tests/test_configure_project.py | Updates configuration-group wiring tests for the new Actions policies group. |
| tests/test_configure_actions_policies.py | Adds offline tests covering Actions policy validation, reads, writes, read-back, checking, and pre-flight behavior. |
| repo-config/README.md | Documents the Actions policy payload and management behavior. |
| repo-config/configure.sh | Implements Actions policy validation, application, checking, read-back, and configuration wiring. |
| repo-config/actions-policies.json | Declares the path-scoped merge-bot pull_request_target policy. |
| OPERATIONS.md | Updates operational guidance for applying repository configuration. |
| docs/repo-config.md | Updates repository configuration guidance for Actions policies. |
| AUDIT.md | Adds Actions event policies to audit coverage. |
Review effort: Lite
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4637 +/- ##
========================================
Coverage 78.47% 78.47%
========================================
Files 58 58
Lines 17873 17873
========================================
Hits 14026 14026
Misses 3847 3847
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
|
/review |
Action not completed
|

Summary
Since 2026-12-02 GitHub blocks
pull_request_targeton every public repository that has no Actions event policy of its own. So every public fleet repository's merge-bot caller failed at startup and no Dependabot or codegen pull request auto-merged.repo-config/now declares the policy that lets the merge-bot run, andconfigure.shmanages it.repo-config/actions-policies.jsonholds one policy. It isactive, scoped byconditions.workflow_path.includeto.github/workflows/merge-bot-pull-request.ymlalone, withallowed_events: ["pull_request_target"]. So no other workflow regains the trigger.ruleset_idwarns and takes the first instead. The difference is deliberate, since a stray same-named policy can restrict events.conditionsandrules, so both modes compare against the single read. Every call sendsX-GitHub-Api-Version: 2026-03-10.read_back_settlesnow passes trailing arguments to its read function. Its one existing caller passes none.repo-config/README.md,docs/repo-config.md,OPERATIONS.md, andAUDIT.mdname the new group.Closes #4633
Verification
pull_requestCI and Dependabot runs outside the policy's path still ran.configure.sh check ptr727/ProjectTemplate releasereports the new group as matching the live policy.tests/test_configure_actions_policies.pyadds 24 offline cases with onlyghstubbed. They cover the payload contract, the live read's refusals, create, update, match, read-back, the check paths, and thecmd_applypre-flight aborting before any write. Thetest_configure*.pysuite runs 216 tests. Its threeAuditDiscussionsCaseerrors are a missingmarkdown_itmodule on the local host, in code this change does not touch.Local Review Findings
Three recorded
local-strict-reviewpasses ran. The first two raised nine findings, all fixed. The edit budget was spent with one finding open:repo-config/configure.shline 819, inapply_project's comment, says resolving the node id there would abort the run "after the four earlier groups had already been written". Six groups now run before it. The number should be dropped rather than corrected.Fleet state: the policy now exists on every fleet repository, private ones and the two public repositories without a merge-bot included, created by the same one-off script and read back by id. So
configure.sh checkfinds it everywhere.This pull request adds comment lines in
configure.shand the new test, so it carries thecommentslabel.🤖 Generated with Claude Code