feat(ci): add CI-gated PR auto-approval to Justice bot#430
Conversation
Justice bot now auto-approves PRs after CI passes, satisfying the branch protection PR approval requirement while maintaining enforce_admins: true (OpenSSF Scorecard Tier 5 = 10/10). Two approval paths: - Dependency bot PRs: immediate approval on safe verdict - All PRs: CI-gated approval via workflow_run trigger SECURITY.md updated to document branch protection policy. Resolves #429 Signed-off-by: Null;Variant <null@nullvariant.com> 🖥️ IDE: [VS Code](https://code.visualstudio.com/) 🔌 Extension: [Claude Code](https://claude.ai/download) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Model-Raw: claude-opus-4-6
Review Summary by QodoAdd CI-gated PR auto-approval to Justice bot workflow
WalkthroughsDescription• Add CI-gated PR auto-approval workflow for Justice bot • Implement two approval paths: dependency bot immediate approval and CI-triggered approval • Resolve PR lookup from commit SHA via GitHub API for workflow_run events • Prevent duplicate approvals with existing review check • Document branch protection policy in SECURITY.md Diagramflowchart LR
CI["CI Workflow Completes"]
WR["workflow_run Event Triggered"]
FIND["Find PR by Commit SHA"]
CHECK["Check for Existing Approvals"]
APPROVE["Approve PR"]
COMMENT["Post Verdict Comment"]
CI -- "success" --> WR
WR --> FIND
FIND --> CHECK
CHECK -- "no existing approval" --> APPROVE
APPROVE --> COMMENT
File Changes1. .github/workflows/justice-bot.yml
|
Code Review by Qodo
1.
|
🐰 Mimi's Validation Report ✅All checks are looking good! Great job! 🎉 ⏳ Some checks are still running. I will keep watching!
This report was carefully prepared by nullvariant-mimi[bot] |
Dependency ReviewThe following issues were found:
Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. License Issuespackage-lock.json
OpenSSF Scorecard
Scanned Files
|
🦥 Slow's Code Review 😩...yawn... Do I really have to review this?
| Split it up... reading long files is exhausting.
This review was reluctantly filed by nullvariant-slow[bot] |
🕊️ Ciel's Mediation 🌤️*~~ floating down from the clouds ~~ The zoo seems a bit noisy today...* 2 zoo members have reviewed this PR.
⚖️ The zoo has mixed opinions. Some are concerned, some are fine with it. Please review each comment carefully and make the final call.
This mediation was peacefully delivered by nullvariant-ciel[bot] |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Reject fork PRs from auto-approval by checking workflow_run.head_repository.full_name matches the current repository. Aligns with the existing fork protection posture. Signed-off-by: Null;Variant <null@nullvariant.com> 🖥️ IDE: [VS Code](https://code.visualstudio.com/) 🔌 Extension: [Claude Code](https://claude.ai/download) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Model-Raw: claude-opus-4-6
Resolve GHSA-r5fr-rjxr-66jc (Code Injection via _.template) and GHSA-f23m-r3pf-42rh (Prototype Pollution via _.unset/_.omit). Signed-off-by: Null;Variant <null@nullvariant.com> 🖥️ IDE: [VS Code](https://code.visualstudio.com/) 🔌 Extension: [Claude Code](https://claude.ai/download) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Model-Raw: claude-opus-4-6
- Add explicit null check for head_repository in fork guard - Add multiple-PR match guard in commits API lookup - Improve commit API comment accuracy (workflow_run.pull_requests caveat) - Add relationship comment between dependency-review and ci-gated-approve - Sanitize USER_MESSAGE input (truncate + strip control chars) - Update SECURITY.md to reflect all-PR auto-approval policy Signed-off-by: Null;Variant <null@nullvariant.com> 🖥️ IDE: [VS Code](https://code.visualstudio.com/) 🔌 Extension: [Claude Code](https://claude.ai/download) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Model-Raw: claude-opus-4-6
|



Summary
workflow_runtrigger after CI succeedsenforce_admins: trueis maintained (OpenSSF Scorecard Tier 5 = 10/10)Next step (after merge)
Branch Protection setting update via API:
required_pull_request_reviews(1 reviewer minimum, dismiss stale reviews)Test plan
ci-gated-approvejob triggers on CI completion (workflow_run event)Resolves #429
🤖 Generated with Claude Code