-
Notifications
You must be signed in to change notification settings - Fork 157
44 lines (38 loc) · 1.57 KB
/
publish-pr-coverage-results.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
name: Publish Code Coverage Results
on:
workflow_run:
workflows: ["Receive Pull Request"]
types:
- completed
jobs:
publish-test-results:
name: Publish Code Coverage Results
runs-on: ubuntu-latest
# the build-and-test job might be skipped, we don't need to run this job then
if: >
${{ github.event.workflow_run.event == 'pull_request' &&
( github.event.workflow_run.conclusion == 'success' ||
github.event.workflow_run.conclusion == 'failure' ) }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_branch }}
- name: 'Download artifact'
uses: actions/download-artifact@v4
with:
name: coverage-reports
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Set Coverage Report Paths
id: coverage-paths
run: |
readarray -d '' coveragePathArray < <(find . -name "coverage.cobertura.xml" -print0)
coveragePaths=$(printf -- "-r %s " "${coveragePathArray[@]}")
echo "COVERAGE_REPORT_PATHS=$coveragePaths" >> $GITHUB_OUTPUT
- name: Publish Code Coverage Results
run: |
auth="--project-token ${{ secrets.CODACY_PROJECT_TOKEN }}"
bash <(curl -Ls https://coverage.codacy.com/get.sh) report $auth \
--commit-uuid ${{ github.event.workflow_run.head_sha }} \
${{ steps.coverage-paths.outputs.COVERAGE_REPORT_PATHS }} --partial &&\
bash <(curl -Ls https://coverage.codacy.com/get.sh) final $auth