ci(sonar): resolve fork PR numbers for finalize - #117
Conversation
workflow_run.pull_requests and commits/{sha}/pulls are empty for fork PR
heads, so Sonar never re-analyzed those PRs. Fall back to matching an open
PR by headRefOid.
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Warning Review limit reached
Next review available in: 72 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. 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: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
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 |
|
Opened from a stale fork main that lacked finalize.yml; recreating from upstream main. |
There was a problem hiding this comment.
Pull request overview
Adds a new finalize GitHub Actions workflow to run SonarCloud analysis after the CI workflow completes, with special handling to resolve PR metadata for fork-based pull requests.
Changes:
- Introduces
.github/workflows/finalize.ymltriggered viaworkflow_runforCIcompletion. - Resolves PR number/base/head for fork PRs by falling back to matching an open PR via
headRefOid(head commit SHA). - Creates/updates a dedicated
sonarcheck run and runs the SonarCloud scan using coverage artifacts from the originating workflow run.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| permissions: | ||
| actions: read | ||
| checks: write | ||
| contents: read | ||
| pull-requests: read | ||
| statuses: write |
| - name: Download coverage artifact | ||
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 | ||
| with: | ||
| name: sonar-coverage | ||
| path: packages/daemon/coverage | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| run-id: ${{ github.event.workflow_run.id }} |
| PR_NUMBER=$(gh pr list --repo "${REPO}" --state open --limit 100 \ | ||
| --json number,headRefOid \ | ||
| --jq ".[] | select(.headRefOid == \"${HEAD_SHA}\") | .number" \ | ||
| | head -n1) |
Summary
Unable to resolve a trusted PR numberbecauseworkflow_run.pull_requestsandcommits/{sha}/pullsreturn empty for fork head SHAs.headRefOid.Test plan
test-env.tscoverage findingsMade with Cursor