Skip to content

Commit 9b12156

Browse files
committed
GH Actions: allow test runs to succeed on fork
As things were, test runs on forks (when the `master` branch in the fork is updated) would always fail on the "upload code coverage reports" step, as forks (justifiably) don't have access to the `CODECOV_TOKEN`. Fixed now by adding a condition for running that step and for efficiency, adding the same condition to the steps running the tests.
1 parent 7dbc496 commit 9b12156

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.github/workflows/php-qa.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,16 @@ jobs:
6565
run: ./vendor/bin/phpunit --migrate-configuration
6666

6767
- name: Run unit tests (without code coverage)
68-
if: ${{ matrix.php-versions != '7.4' || matrix.dependency-versions != 'highest' }}
68+
if: ${{ matrix.php-versions != '7.4' || matrix.dependency-versions != 'highest' || github.event.repository.fork == true }}
6969
run: ./vendor/bin/phpunit
7070

7171
- name: Run unit tests with code coverage
72-
if: ${{ matrix.php-versions == '7.4' && matrix.dependency-versions == 'highest' }}
72+
if: ${{ matrix.php-versions == '7.4' && matrix.dependency-versions == 'highest' && github.event.repository.fork == false }}
7373
run: ./vendor/bin/phpunit --coverage-clover=coverage.xml
7474

7575
- name: Update codecov.io
7676
uses: codecov/codecov-action@v5
77-
if: ${{ matrix.php-versions == '7.4' && matrix.dependency-versions == 'highest' }} # upload coverage once is enough
77+
if: ${{ matrix.php-versions == '7.4' && matrix.dependency-versions == 'highest' && github.event.repository.fork == false }} # upload coverage once is enough
7878
env:
7979
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
8080
with:

0 commit comments

Comments
 (0)