diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index ba1e914e..12737971 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -22,11 +22,13 @@ jobs: run: pdm run python -m pytest tests/unit --cov=ols --cov=runner --cov-report xml - name: Upload coverage reports to Codecov with GitHub Action (with token = main repo) - if: github.repository == 'road-core/service' + if: | + github.event_name == 'push' && github.repository == 'road-core/service' || + github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'road-core/service' uses: codecov/codecov-action@v4.2.0 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - name: Upload coverage reports to Codecov with GitHub Action (without token = forks) - if: github.repository != 'road-core/service' + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'road-core/service' uses: codecov/codecov-action@v4.2.0