Skip to content

Commit e589a26

Browse files
Coverage: add detailed report to job summary (#655)
Co-authored-by: Daniel Sperber <[email protected]>
1 parent 67d37fe commit e589a26

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ jobs:
180180
echo "Creating coverage report..."
181181
# Create xml file for further processing; Create even if below minimum
182182
coverage xml --fail-under=0
183+
# Write markdown report to job summary
184+
coverage report --fail-under=0 --format=markdown -m >> "$GITHUB_STEP_SUMMARY"
183185
184186
# For future use in case we want to add a PR comment for 3rd party PRs which requires
185187
# a workflow with elevated PR write permissions. Move below steps into a separate job.
@@ -210,6 +212,12 @@ jobs:
210212
# Note: it appears fail below min is one off, use fail_under -1 here
211213
thresholds: '95 98'
212214

215+
- name: Add link to report badge
216+
if: ${{ always() && steps.cov_xml_upload.outputs.artifact-id != '' }}
217+
run: |
218+
run_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}?pr=${{ github.event.pull_request.number }}"
219+
sed -i "1s|^\(!.*\)$|[\1]($run_url)|" code-coverage-results.md
220+
213221
- name: Add Coverage PR Comment
214222
uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728 # v2.9.3
215223
# Create PR comment when the branch is on the repo, otherwise we lack PR write permissions

0 commit comments

Comments
 (0)