-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (59 loc) · 2.2 KB
/
codecov-upload.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
53
54
55
56
57
58
59
60
61
62
name: Upload to Codecov
on:
workflow_run:
workflows:
- Checks
types:
- completed
jobs:
show-info:
runs-on: ubuntu-latest
steps:
- name: Show event payload
uses: actions/github-script@v7
with:
script: |
txt = JSON.stringify(context.payload.workflow_run, null, 4);
core.summary.addCodeBlock(txt, 'json');
core.summary.write()
upload:
name: Upload coverage reports
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
repository: ${{ github.event.workflow_run.head_repository.full_name }}
ref: ${{ github.event.workflow_run.head_sha }}
- name: Display codecov.yml file
run: cat codecov.yml
- name: Download artifacts from triggering workflow
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ls -lahR
gh run download ${{ github.event.workflow_run.id }} --repo ${{ github.repository }} --pattern 'coverage-report-*'
ls -lahR
- name: Get PR number from triggered event payload
if: ${{ github.event.workflow_run.event == 'pull_request' }}
id: pr-info
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh run download ${{ github.event.workflow_run.id }} --repo ${{ github.repository }} --name event-payload
ls -lah
pr_number="$(jq < event.json '.number')"
echo "number=$pr_number" >> "$GITHUB_OUTPUT"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
name: ${{ github.event.workflow_run.id }}
job_code: ${{ github.event.workflow_run.name }}
override_build: ${{ github.event.workflow_run.id }}
override_build_url: ${{ github.event.workflow_run.html_url }}
override_commit: ${{ github.event.workflow_run.head_sha }}
override_branch: ${{ github.event.workflow_run.head_branch }}
override_pr: ${{ github.event.workflow_run.event == 'pull_request' && steps.pr-info.outputs.number || '' }}