Skip to content

Commit 80f82ec

Browse files
committed
Fix CI issues for Dependabot PRs - prevent duplicate runs and handle Codecov token issues
1 parent f61e27a commit 80f82ec

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
name: CI
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
48

59
jobs:
610
python:
11+
# Prevent duplicate runs on PRs from the same repository
12+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
713
runs-on: ${{ matrix.os }}
814
strategy:
915
matrix:
@@ -57,14 +63,25 @@ jobs:
5763
run: poetry run pytest tests
5864

5965
- name: Upload coverage reports
60-
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
66+
# Only upload coverage if we have a token (skip for Dependabot PRs)
67+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' && (github.event_name != 'pull_request' || github.actor != 'dependabot[bot]')
6168
uses: codecov/codecov-action@v4
6269
with:
6370
token: ${{ secrets.CODECOV_TOKEN }}
6471
files: ./coverage.xml
6572
flags: unittests
6673
name: python-sdk
67-
fail_ci_if_error: true
74+
fail_ci_if_error: false
75+
76+
- name: Upload coverage reports (tokenless)
77+
# Use tokenless upload for Dependabot PRs
78+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' && github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
79+
uses: codecov/codecov-action@v4
80+
with:
81+
files: ./coverage.xml
82+
flags: unittests
83+
name: python-sdk
84+
fail_ci_if_error: false
6885

6986
- name: Upload coverage artifacts
7087
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'

0 commit comments

Comments
 (0)