Skip to content

Commit 5e664b7

Browse files
committed
Separate codecov steps for PRs and non-PRs
1 parent 1d2b6c1 commit 5e664b7

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

.github/workflows/ci-test.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,26 @@ jobs:
144144
if: matrix.backend == 'redis'
145145
run: pytest -m redis --cov=cachier --cov-report=term --cov-report=xml:cov.xml
146146

147-
- name: Upload coverage to Codecov
147+
- name: Upload coverage to Codecov (non-PRs)
148+
if: github.event_name != 'pull_request' # pushes, scheduled, etc.
148149
continue-on-error: true
149150
uses: codecov/codecov-action@v5
150151
with:
151152
fail_ci_if_error: true
152-
name: codecov-umbrella
153153
token: ${{ secrets.CODECOV_TOKEN }} # required
154154
flags: ${{ matrix.backend }}
155155

156+
# We need a separate step for PRs because PRs do not have access to
157+
# secrets; hence, provide the token will give it an empty value,
158+
# resulting in an authentication error.
159+
- name: Upload coverage to Codecov (PRs)
160+
if: github.event_name == 'pull_request' # PRs only
161+
continue-on-error: true
162+
uses: codecov/codecov-action@v5
163+
with:
164+
fail_ci_if_error: true
165+
flags: ${{ matrix.backend }}
166+
156167
testing-guardian:
157168
runs-on: ubuntu-latest
158169
needs: pytester

0 commit comments

Comments
 (0)