ci(test-unit): report coverage in job summary and PR comment - #1722
ci(test-unit): report coverage in job summary and PR comment#1722joanestebanr wants to merge 1 commit into
Conversation
Replace the coverage visibility lost with the SonarCloud removal (#1719): print the total from coverage.out to the job summary, upload the profile as an artifact, and post a sticky diff-coverage comment on PRs with fgrosse/go-coverage-report using the base-branch artifact as baseline. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 27553d686b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| code-coverage-report: | ||
| name: code-coverage-report | ||
| if: github.event_name == 'pull_request' |
There was a problem hiding this comment.
Skip coverage comments on fork PRs
This job now runs for every pull_request, including PRs opened from forks. In that context GitHub downgrades GITHUB_TOKEN to read-only, while fgrosse/go-coverage-report@v1.3.0 ends by calling gh pr comment under set -e and its own README notes fork support is limited because the token cannot post PR comments. Those forked PRs will therefore get a failed code-coverage-report check even when test-unit passes; gate this job to same-repository PRs or make the comment step non-fatal for forks.
Useful? React with 👍 / 👎.
🔄 Changes Summary
coverage.outthatmake test-unitalready generates:go tool cover -functo the workflow run's job summarycoverage.outas thecoverageartifact (downloadable forgo tool cover -htmlinspection; also serves as the diff baseline on pushes todevelop/main/release/**)code-coverage-reportjob (PRs only) posts a sticky comment with the total coverage delta vs the base branch and per-file coverage of changed packages, viafgrosse/go-coverage-report@v1.3.0pull-requests: writeto comment,actions: readto download the base-branch artifact); thetest-unitjob is unchanged📋 Config Updates
✅ Testing
test-unitruns unchanged on this PR; the new summary step and artifact upload execute in this PR's runcoverage.outprofile🔗 Related PRs
📝 Notes
code-coverage-reportjob will fail on PRs with "artifact not found" until this change lands ondevelopand a push run uploads the first baselinecoverageartifact. It is a separate job, sotest-unititself is unaffected.pull-requests: writeon forked PRs)🤖 Generated with Claude Code