CodeCoverageSummary icon indicating copy to clipboard operation
CodeCoverageSummary copied to clipboard

Add summary to a PR

Open irongut opened this issue 4 years ago • 2 comments

Feature Request

Add the code coverage summary to a pull request without needing another Action. This could be optional.

Using Octokit this should be straightforward, if run from a PR the id of the PR can be obtained from the runner environment. An optional id parameter could allow posting to a PR when not run from a PR (e.g. manual run).

Expected Behaviour

Posts the coverage summary to a PR in a similar way to the marocchino/sticky-pull-request-comment action.

Additional Context

Linked To

irongut avatar Oct 16 '21 20:10 irongut

You can use a third-party action for that, like so:

  steps:
    - name: Code Coverage Summary Report
      uses: irongut/[email protected]
      with:
        filename: coverage.xml
        badge: true
        format: "markdown"
        output: "both"

    - name: Add Coverage PR Comment
      uses: marocchino/sticky-pull-request-comment@v2
      if: github.event_name == 'pull_request'
      with:
        recreate: true
        path: code-coverage-results.md

    - name: Write to Job Summary
      run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY

fredrikaverpil avatar Nov 16 '22 20:11 fredrikaverpil

This would be useful for the cases if the threshold isn't being met. It would be nice to see the code coverage report on the PR despite the fact that the action will cause a failure.

deanro avatar Jan 28 '23 20:01 deanro