Skip to content

feat: implement issue #216 — [Fleet Monitor] petry-projects/ContentTwin — pr-auto-review.yml - #249

Merged
don-petry merged 25 commits into
mainfrom
dev-lead/issue-216-20260609-0510
Jun 20, 2026
Merged

feat: implement issue #216 — [Fleet Monitor] petry-projects/ContentTwin — pr-auto-review.yml#249
don-petry merged 25 commits into
mainfrom
dev-lead/issue-216-20260609-0510

Conversation

@don-petry

@don-petry don-petry commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Closes #216

Implemented by dev-lead agent. Please review.

Summary by CodeRabbit

  • Chores
    • Enhanced repository automation to configure and verify GitHub Actions fork-PR contributor approval policy for first-time contributors submitting from forks.
    • Added an automated verification step that confirms the approval policy is applied and surfaces an error if configuration validation fails, helping ensure consistent enforcement of contribution approvals.

@don-petry
don-petry requested a review from a team as a code owner June 9, 2026 05:20
Copilot AI review requested due to automatic review settings June 9, 2026 05:20
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates the repository settings automation script to adjust the fork-PR contributor approval policy so that PR Auto-Review workflow runs are less likely to be gated as action_required, addressing the elevated failure rate flagged in issue #216.

Changes:

  • Adds a GitHub Actions fork-PR contributor approval policy update (first_time_contributors_new_to_github) via gh api.
  • Adds a lightweight verification step to fetch and report the configured approval_policy.

Comment thread scripts/apply-repo-settings.sh Outdated
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@don-petry, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 50 minutes and 15 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

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, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: be00da15-051f-4412-8e67-c0498699d541

📥 Commits

Reviewing files that changed from the base of the PR and between 8ef1e7f and 94595f0.

📒 Files selected for processing (2)
  • scripts/apply-repo-settings.sh
  • scripts/tests/apply-repo-settings.bats
📝 Walkthrough

Walkthrough

The script now configures and verifies a GitHub fork-PR contributor approval policy. After disabling the Claude app's check-suite auto-trigger, it sets actions/permissions/fork-pr-contributor-approval.approval_policy to first_time_contributors_new_to_github via API and validates the configured value by reading it back.

Changes

Fork PR Contributor Approval Policy

Layer / File(s) Summary
Fork-PR approval policy configuration and verification
scripts/apply-repo-settings.sh
Script adds a GitHub API PUT to set fork-pr-contributor-approval.approval_policy to first_time_contributors_new_to_github, then GETs the configured value and emits [OK] or [ERROR] and exits non‑zero on mismatch.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title mentions issue #216 and pr-auto-review.yml, but the actual change is only to scripts/apply-repo-settings.sh with no modifications to the workflow file itself. Update the title to accurately reflect that this adds a GitHub Actions fork-PR approval policy setting, not a pr-auto-review.yml workflow fix.
Linked Issues check ⚠️ Warning Issue #216 reports a 15% failure rate warning for the pr-auto-review.yml workflow, but the PR changes scripts/apply-repo-settings.sh to configure fork-PR approval policies, which is unrelated to addressing workflow failures. Clarify how the fork-PR approval policy setting addresses the workflow's 15% failure rate, or verify this PR is intended to fix issue #216.
Out of Scope Changes check ⚠️ Warning The script modification to configure fork-PR approval policies in apply-repo-settings.sh appears unrelated to addressing the pr-auto-review.yml workflow failure rate warning documented in issue #216. Verify that fork-PR approval policy configuration is the intended fix for issue #216, or provide additional context explaining the connection.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-lead/issue-216-20260609-0510

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates scripts/apply-repo-settings.sh to loosen the fork pull request contributor approval policy to first_time_contributors_new_to_github. However, the review highlights a critical issue: the GitHub REST API endpoint used to set this policy does not exist, and the script needs to be updated to use the correct workflow permissions endpoint.

Comment thread scripts/apply-repo-settings.sh Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/apply-repo-settings.sh`:
- Around line 93-99: The POLICY read-back currently swallows failures and only
warns on mismatch; change the gh api call used to set POLICY (gh api
"repos/$REPO/actions/permissions/fork-pr-contributor-approval") to detect
failure and exit non-zero: run the gh api command without redirecting stderr,
capture its exit status, and if it fails print an error and exit 1; then compare
the captured POLICY value to "first_time_contributors_new_to_github" and if it
does not match print an error and exit 1 (instead of just warning), ensuring the
script fails hard when the API read or policy verification fails.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f3b6a040-be99-4796-b0bd-22191770b426

📥 Commits

Reviewing files that changed from the base of the PR and between e4d03e2 and 64727f2.

📒 Files selected for processing (1)
  • scripts/apply-repo-settings.sh

Comment thread scripts/apply-repo-settings.sh Outdated
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-bot-comment (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) June 13, 2026 10:31
@don-petry
don-petry disabled auto-merge June 13, 2026 10:33
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) June 13, 2026 10:36
@don-petry
don-petry disabled auto-merge June 13, 2026 10:38
@donpetry-bot

Copy link
Copy Markdown
Contributor

@donpetry-bot I'm on it — starting a fresh review now. Results will appear in a few minutes.

6 similar comments
@donpetry-bot

Copy link
Copy Markdown
Contributor

@donpetry-bot I'm on it — starting a fresh review now. Results will appear in a few minutes.

@donpetry-bot

Copy link
Copy Markdown
Contributor

@donpetry-bot I'm on it — starting a fresh review now. Results will appear in a few minutes.

@donpetry-bot

Copy link
Copy Markdown
Contributor

@donpetry-bot I'm on it — starting a fresh review now. Results will appear in a few minutes.

@donpetry-bot

Copy link
Copy Markdown
Contributor

@donpetry-bot I'm on it — starting a fresh review now. Results will appear in a few minutes.

@donpetry-bot

Copy link
Copy Markdown
Contributor

@donpetry-bot I'm on it — starting a fresh review now. Results will appear in a few minutes.

@donpetry-bot

Copy link
Copy Markdown
Contributor

@donpetry-bot I'm on it — starting a fresh review now. Results will appear in a few minutes.

@donpetry-bot donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated review — APPROVED ✓

Risk: MEDIUM
Reviewed commit: 0b01c2cdfcde66226af6a5e1b4a0e4d358b00a72
Review mode: triage-approved (single reviewer)

Summary

PR #216 fix: apply-repo-settings.sh now sets the fork-PR contributor approval policy to first_time_contributors_new_to_github and verifies it, so the Copilot reviewer bot stops landing workflow runs in action_required purgatory (which had pushed pr-auto-review.yml over the fleet-monitor failure threshold). Small (+36/-0, 2 files), test-covered, all CI green.

Linked issue analysis

Closes #216. The root cause was the default first_time_contributors policy treating the Copilot PR-reviewer bot as a first-time contributor on each PR, gating its pull_request_review workflow runs to action_required, which fleet_monitor.sh counts as failures. Narrowing the policy to first_time_contributors_new_to_github addresses this directly while still gating genuinely new-to-GitHub fork contributors. Substantively addressed.

Findings

  • Change is self-verifying: under set -euo pipefail, the gh api -X PUT and the read-back gh api ... --jq .approval_policy both hard-fail (exit 1) on any API error or value mismatch, so a wrong endpoint/payload would surface loudly rather than silently misreport success.
  • A prior bot review (gemini) flagged the actions/permissions/fork-pr-contributor-approval endpoint as non-existent. This is the documented GitHub REST endpoint for fork-PR contributor approval and accepts approval_policy; the HEAD code uses it correctly. That thread is resolved/outdated.
  • Minor (non-blocking): the author's final thread comment states the endpoint was switched to actions/permissions with enabled_for_fork_pull_requests, but HEAD still uses fork-pr-contributor-approval + approval_policy. HEAD is the correct form, so this is a stale comment, not a code defect — worth a glance to confirm intent.
  • Security note: this loosens a GitHub Actions fork-PR approval control, but the scope is narrow (only accounts new to GitHub are now exempted) and well-justified in an inline comment. bats test covers the new branch.

CI status

All 3 checks green: CodeQL / Analyze (actions) SUCCESS, CodeRabbit SUCCESS. SonarQube Cloud quality gate passed (0 new issues). mergeable=MERGEABLE (mergeStateStatus BLOCKED pending this required review). No failing or pending checks.


Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.

@don-petry
don-petry disabled auto-merge June 20, 2026 01:46
@sonarqubecloud

Copy link
Copy Markdown

@don-petry
don-petry enabled auto-merge (squash) June 20, 2026 01:48
@don-petry
don-petry merged commit a83d694 into main Jun 20, 2026
19 of 22 checks passed
@don-petry
don-petry deleted the dev-lead/issue-216-20260609-0510 branch June 20, 2026 01:49
@github-actions

Copy link
Copy Markdown
Contributor

CI Failure: SonarCloud Code Analysis

Step: Quality Gate (SonarCloud Code Analysis)
Root cause: Lint/style

SonarCloud detected 10 new Security Hotspots in the changes introduced by this PR. The added shell script code in scripts/apply-repo-settings.sh constructs JSON via a here-doc with shell variable interpolation (${EXPECTED_APPROVAL_POLICY} and $REPO), which SonarCloud flags as potential injection risks even when the values are hardcoded readonly constants. This causes the Quality Gate to fail its security hotspot condition.

Suggested fix: Open the SonarCloud Security Hotspots dashboard, review each of the 10 hotspots, and either mark confirmed false-positives as "Safe" (if the values are provably static) or refactor the API call to use gh api --field approval_policy=first_time_contributors_new_to_github instead of constructing JSON via here-doc interpolation.

View analysis details

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.

[Fleet Monitor] petry-projects/ContentTwin — pr-auto-review.yml

3 participants