From b3a9b18e2ea188767213a3e9d5260cbfcacd3106 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Thu, 2 May 2024 08:16:56 +1000 Subject: [PATCH] [#163] Run upload to Codecov step only if the token was provided. --- .github/workflows/test-php.yml | 3 +++ .github/workflows/test-scaffold.yml | 3 +++ .github/workflows/test-shell.yml | 6 ++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-php.yml b/.github/workflows/test-php.yml index c748531..7d79694 100644 --- a/.github/workflows/test-php.yml +++ b/.github/workflows/test-php.yml @@ -52,10 +52,13 @@ jobs: - name: Upload coverage report to Codecov uses: codecov/codecov-action@v4 + if: ${{ env.CODECOV_TOKEN != '' }} with: files: ./cobertura.xml fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} # yamllint disable-line #;< PHP_PHAR build-php: diff --git a/.github/workflows/test-scaffold.yml b/.github/workflows/test-scaffold.yml index b1129e6..1f00fb9 100644 --- a/.github/workflows/test-scaffold.yml +++ b/.github/workflows/test-scaffold.yml @@ -53,7 +53,10 @@ jobs: - name: Upload coverage report to Codecov uses: codecov/codecov-action@v4 + if: ${{ env.CODECOV_TOKEN != '' }} with: directory: ./.scaffold-coverage-html fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/test-shell.yml b/.github/workflows/test-shell.yml index 78bf8c9..e36778a 100644 --- a/.github/workflows/test-shell.yml +++ b/.github/workflows/test-shell.yml @@ -67,13 +67,15 @@ jobs: path: ./.coverage-html if-no-files-found: error - - name: Upload coverage reports to Codecov - if: matrix.os == 'ubuntu-latest' + - name: Upload coverage report to Codecov uses: codecov/codecov-action@v4 + if: ${{ env.CODECOV_TOKEN != '' && matrix.os == 'ubuntu-latest' }} with: directory: ./.coverage-html fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - name: Run Tests on other OSes if: matrix.os != 'ubuntu-latest'