Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,35 @@ jobs:

- name: Test
run: make test-unit

- name: Coverage summary
run: |
{
echo "## Coverage"
echo ""
echo '```'
go tool cover -func=coverage.out | tail -n 1
echo '```'
} >> "$GITHUB_STEP_SUMMARY"

- name: Upload coverage profile
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage.out

code-coverage-report:
name: code-coverage-report
if: github.event_name == 'pull_request'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 πŸ‘Β / πŸ‘Ž.

runs-on: ubuntu-latest
needs: test-unit
permissions:
contents: read
actions: read
pull-requests: write
steps:
- name: Post coverage report on the PR
uses: fgrosse/go-coverage-report@v1.3.0
with:
coverage-artifact-name: coverage
coverage-file-name: coverage.out
Loading