-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (62 loc) · 1.88 KB
/
Copy pathtests-report.yaml
File metadata and controls
70 lines (62 loc) · 1.88 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: tests-report
on:
workflow_run:
workflows: ['tests']
types: [completed]
permissions:
actions: read
contents: read
pull-requests: write
jobs:
tests-report:
runs-on: ubuntu-latest
steps:
- name: Clone source
uses: actions/checkout@v4
- name: Determine PR number
id: get_pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
SHA="${{ github.event.workflow_run.head_sha }}"
GHPR=$(gh pr list --state open --json number,headRefOid --jq ".[] | select(.headRefOid==\"${SHA}\") | .number")
if [ -z "$GHPR" ]; then
echo "SHA ${SHA} is not associated with a GitHub PR; skipping some reports"
fi
echo "GHPR=$GHPR" >> $GITHUB_ENV
- name: Download tests artifact
uses: actions/download-artifact@v7
if: env.GHPR != ''
with:
name: test-results
run-id: ${{ github.event.workflow_run.id }}
path: artifacts
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Generate coverage report
uses: irongut/CodeCoverageSummary@v1.3.0
if: env.GHPR != ''
with:
filename: artifacts/coverage.cobertura.xml
badge: true
format: markdown
hide_branch_rate: false
hide_complexity: false
indicators: true
output: file
- name: Publish coverage report as PR comment
uses: marocchino/sticky-pull-request-comment@v2
if: env.GHPR != ''
with:
number: ${{ env.GHPR }}
path: code-coverage-results.md
- name: Publish test results report as PR comment
uses: ctrf-io/github-test-reporter@v1
if: env.GHPR != ''
with:
report-path: artifacts/tests.ctrf
issue: ${{ env.GHPR }}
pull-request-report: true
overwrite-comment: true
comment-tag: test-report
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}