Skip to content

Commit f2e31cd

Browse files
committed
ci: upload Codecov via token or OIDC
1 parent 0cc4c3a commit f2e31cd

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ jobs:
5757
coverage:
5858
name: Coverage (Codecov)
5959
runs-on: ubuntu-latest
60+
permissions:
61+
contents: read
62+
id-token: write
6063
steps:
6164
- uses: actions/checkout@v4
6265

@@ -98,8 +101,8 @@ jobs:
98101
--ignore-errors unused
99102
lcov --list coverage.info --rc branch_coverage=1
100103
101-
- name: Upload to Codecov
102-
if: github.event_name == 'push'
104+
- name: Upload to Codecov (token)
105+
if: github.event_name == 'push' && secrets.CODECOV_TOKEN != ''
103106
uses: codecov/codecov-action@v5
104107
with:
105108
token: ${{ secrets.CODECOV_TOKEN }}
@@ -108,3 +111,14 @@ jobs:
108111
plugins: noop
109112
fail_ci_if_error: true
110113
verbose: true
114+
115+
- name: Upload to Codecov (OIDC)
116+
if: github.event_name == 'push' && secrets.CODECOV_TOKEN == ''
117+
uses: codecov/codecov-action@v5
118+
with:
119+
use_oidc: true
120+
files: coverage.info
121+
disable_search: true
122+
plugins: noop
123+
fail_ci_if_error: true
124+
verbose: true

0 commit comments

Comments
 (0)