Skip to content

feat: check third-party bot statuses in require-ci-green-before-stop - #92

Merged
NiveditJain merged 1 commit into
mainfrom
luv-90
Apr 14, 2026
Merged

feat: check third-party bot statuses in require-ci-green-before-stop#92
NiveditJain merged 1 commit into
mainfrom
luv-90

Conversation

@NiveditJain

@NiveditJainNiveditJain commented Apr 14, 2026

Copy link
Copy Markdown
Member

Summary

  • The require-ci-green-before-stop policy previously only checked GitHub Actions workflow runs (gh run list), completely missing third-party bot checks like CodeRabbit, SonarCloud, Codecov, etc.
  • Now also queries the GitHub Checks API (gh api repos/{owner}/{repo}/commits/{sha}/check-runs) to pick up those bot statuses, filtering out github-actions app checks to avoid double-counting
  • Both sources are fail-open independently — if one API call fails, the other still evaluates

Test plan

  • All 854 unit tests pass (bun run test:run)
  • 7 new test cases for third-party check scenarios (failing, in-progress, mixed, fail-open, skipped)
  • Build passes (bun run build)
  • All 182 e2e tests pass (bun run test:e2e)
  • CI green on push

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Extended CI validation to include third-party bot checks (CodeRabbit, SonarCloud, Codecov) alongside GitHub Actions in the require-ci-green-before-stop policy.
  • Documentation

    • Updated policy documentation to reflect third-party bot check evaluation.
  • Tests

    • Added test coverage for third-party check runs behavior and failure scenarios.

…policy
The policy previously only checked GitHub Actions workflow runs via
`gh run list`, missing third-party bot checks (CodeRabbit, SonarCloud,
Codecov, etc.) that report via the GitHub Checks API. Now also queries
the Checks API to catch those, while filtering out GitHub Actions checks
to avoid double-counting. Both sources are fail-open independently.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitaiBot commented Apr 14, 2026

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

The PR extends the require-ci-green-before-stop policy to evaluate both GitHub Actions workflow runs and third-party bot check runs (e.g., CodeRabbit, SonarCloud) when determining whether to allow stopping an issue. Implementation includes fetching HEAD SHA, querying the Checks API for third-party results, combining both sources, and comprehensive test coverage.

Changes

Cohort / File(s)Summary
Documentation
CHANGELOG.md, docs/built-in-policies.mdx
Updated documentation and changelog to reflect that require-ci-green-before-stop now evaluates both GitHub Actions and third-party bot check runs.
Policy Implementation
src/hooks/builtin-policies.ts
Added getHeadSha() and getThirdPartyCheckRuns() functions; updated requireCiGreenBeforeStop to fetch, combine, and evaluate both Actions runs and third-party checks via the Checks API.
Test Coverage
__tests__/hooks/builtin-policies.test.ts
Enhanced mockCiScenario helper to support third-party check-runs configuration and HEAD SHA mocking; added comprehensive test suite covering third-party check behavior (failures, pending status, skipped conclusion) and error fallback scenarios.

Sequence Diagram

sequenceDiagram
participant Policy as Policy Logic
participant Git as Git (Local)
participant GH as GitHub CLI
participant API as GitHub API
activate Policy
Policy->>Git: rev-parse HEAD
Git-->>Policy: commit SHA
Policy->>GH: gh run list (Actions)
GH->>API: Query Actions runs
API-->>GH: Run status/conclusion
GH-->>Policy: Actions run results
Policy->>GH: gh api check-runs (third-party)
GH->>API: Query Checks API
API-->>GH: Third-party check status
GH-->>Policy: Check-run results
Policy->>Policy: Combine Actions + third-party
Policy->>Policy: Evaluate: failing/pending/passed?
Policy-->>Policy: Return decision + reason
deactivate Policy
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰✨ A rabbit hops through Actions and checks,
Both GitHub and bots pass their respects,
The policy now sees all the light,
Third-party friends verified—everything's right! 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 20.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly and accurately summarizes the main change: adding third-party bot status checks to the require-ci-green-before-stop policy.
Description check✅ PassedThe PR description provides a clear summary and test plan, though it deviates from the template structure by not explicitly selecting Type of Change or completing the formal checklist sections.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch luv-90

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.

@NiveditJain
NiveditJain merged commit a6a6905 into mainApr 14, 2026
7 of 8 checks passed
@NiveditJain
NiveditJain deleted the luv-90 branch April 21, 2026 01:30
Sign up for freeto 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.

1 participant

@NiveditJain