feat: implement issue #323 — Compliance: ruleset-drift-pr-quality-require_code_owner_review - #332
feat: implement issue #323 — Compliance: ruleset-drift-pr-quality-require_code_owner_review#332don-petry wants to merge 2 commits into
Conversation
…uire_code_owner_review
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
Next review available in: 8 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces a bash script (apply-pr-quality-ruleset.sh) and associated BATS tests to idempotently manage the pr-quality branch protection ruleset for the petry-projects/markets repository. The review feedback identifies a critical issue where the allowed_merge_methods parameter is invalid for the pull_request ruleset API and will cause a 422 error, recommending its removal from both the JSON payload and the script's documentation header. Additionally, the feedback suggests removing error silencing (2>/dev/null || true) when querying existing rulesets to ensure the script fails fast on actual API or authentication errors.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a repo-local, idempotent script to enforce the pr-quality GitHub repository ruleset for petry-projects/markets, plus Bats tests that validate the script’s static contents without making live API calls.
Changes:
- Introduce
.github/scripts/apply-pr-quality-ruleset.shto create/update thepr-qualityruleset viagh apiand ajq-built payload. - Add
.github/scripts/tests/apply-pr-quality-ruleset.batsto assert key configuration and idempotent behavior patterns.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| .github/scripts/apply-pr-quality-ruleset.sh | New automation to create/update the pr-quality ruleset with codified PR review requirements. |
| .github/scripts/tests/apply-pr-quality-ruleset.bats | New Bats tests verifying the script contains required settings and uses create/update API calls. |
| @test "script sets require_code_owner_review to true (issue #323)" { | ||
| grep -qE 'require_code_owner_review["[:space:]:]+true' "$SCRIPT" | ||
| } |
There was a problem hiding this comment.
Fixed in .github/scripts/tests/apply-pr-quality-ruleset.bats line 32: updated the ERE pattern from require_code_owner_review["[:space:]:]+true to require_code_owner_review"?:[[:space:]]+true. The new pattern unambiguously matches the jq output format (require_code_owner_review: true) while optionally allowing a surrounding double-quote.
| PAYLOAD=$(jq -n '{ | ||
| name: "pr-quality", |
There was a problem hiding this comment.
Fixed in .github/scripts/apply-pr-quality-ruleset.sh: the PAYLOAD jq call now uses --arg name "$RULESET_NAME" and references $name in the JSON instead of the hardcoded string "pr-quality". RULESET_NAME is now the single source of truth for the ruleset name throughout the script.
| @@ -0,0 +1,89 @@ | |||
| #!/usr/bin/env bash | |||
There was a problem hiding this comment.
Fixed in .github/scripts/apply-pr-quality-ruleset.sh: added explicit dependency checks immediately after set -euo pipefail — command -v gh and command -v jq each emit a clear ERROR: message to stderr and exit 1 if the tool is absent, before any other logic runs. New bats assertions in .github/scripts/tests/apply-pr-quality-ruleset.bats verify both checks are present.
| # canonical tool for managing rulesets across all repos. This script exists as a | ||
| # repo-local reference and fallback for the markets repository specifically. | ||
|
|
||
| set -euo pipefail |
There was a problem hiding this comment.
Fixed in .github/scripts/apply-pr-quality-ruleset.sh: added explicit dependency checks immediately after set -euo pipefail — command -v gh and command -v jq each emit a clear ERROR: message to stderr and exit 1 if the tool is absent, before any other logic runs. New bats assertions in .github/scripts/tests/apply-pr-quality-ruleset.bats verify both checks are present.
| EXISTING_ID=$(gh api "repos/$REPO/rulesets" \ | ||
| --jq ".[] | select(.name == \"$RULESET_NAME\") | .id" 2>/dev/null || true) | ||
|
|
||
| PAYLOAD=$(jq -n '{ |
There was a problem hiding this comment.
Fixed in .github/scripts/apply-pr-quality-ruleset.sh: added explicit dependency checks immediately after set -euo pipefail — command -v gh and command -v jq each emit a clear ERROR: message to stderr and exit 1 if the tool is absent, before any other logic runs. New bats assertions in .github/scripts/tests/apply-pr-quality-ruleset.bats verify both checks are present.
| bypass_actors: [ | ||
| { | ||
| actor_type: "OrganizationAdmin", | ||
| bypass_mode: "always" | ||
| }, | ||
| { | ||
| actor_id: 3167543, | ||
| actor_type: "Integration", | ||
| bypass_mode: "always" | ||
| } | ||
| ], |
There was a problem hiding this comment.
Fixed in .github/scripts/apply-pr-quality-ruleset.sh: added an inline comment identifying integration 3167543 as the donpetry-bot GitHub App and introduced a BYPASS_INTEGRATION_ID env var (defaulting to 3167543) so the value can be overridden without editing the script. The jq payload now uses --argjson bypass_id "$BYPASS_INTEGRATION_ID" and references $bypass_id in the JSON.
Dev-Lead — fix-bot-comment (applied)Changes committed and pushed. |
|
|
Closing as part of the 50-PR cap drain. The dev-lead fix-loop repairs #1340 (self-cancellation), #1290 (comment-inertness) and #806 (thread-resolution) have all landed, so this deadlocked PR can be regenerated cleanly through the repaired loop. The driving issue stays open and its dev-lead label is re-fired — no work is lost. |
Pull request was closed



Closes #323
Implemented by dev-lead agent. Please review.