-
Notifications
You must be signed in to change notification settings - Fork 45
52 lines (45 loc) · 1.7 KB
/
code_coverage_comment.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Add comment with code-coverage to PR
on:
workflow_run:
workflows: ['CI']
branches-ignore: ['dependabot/**']
types: [completed]
jobs:
add-comment-with-code-coverage:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.user.login != 'dependabot[bot]' && github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout project
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Download cobertura.xml file
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e # v2.28.0
with:
run_id: ${{github.event.workflow_run.id }}
name: cobertura
path: .
- name: Download PR_NUMBER
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e # v2.28.0
with:
run_id: ${{github.event.workflow_run.id }}
name: PR_NUMBER
path: .
- name: Extract PR number
id: extract-pr-number
run: |
pr_number=$(cat ./PR_NUMBER)
echo "PR_NUMBER=$pr_number" >> $GITHUB_OUTPUT
- name: Code Coverage Report
uses: irongut/CodeCoverageSummary@51cc3a756ddcd398d447c044c02cb6aa83fdae95 # v1.3.0
with:
filename: cobertura-coverage.xml
badge: true
format: markdown
output: both
thresholds: '60 80'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@efaaab3fd41a9c3de579aba759d2552635e590fd # v2.8.0
with:
recreate: true
header: coverage
number: ${{ steps.extract-pr-number.outputs.PR_NUMBER }}
path: code-coverage-results.md