From 8e6da79132177fe38a298f7843a5abbc0199ad3c Mon Sep 17 00:00:00 2001 From: vil02 Date: Mon, 20 May 2024 21:45:06 +0200 Subject: [PATCH] chore: upload coverage report using `CODECOV_TOKEN` --- .github/workflows/ci.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 26f7b3d8..531eace4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,5 +19,19 @@ jobs: run: dotnet build --no-restore - name: Test run: dotnet test --no-restore --collect "XPlat Code Coverage" - - name: Upload code coverage to Codecov - run: bash <(curl -s https://codecov.io/bash) + - name: Upload coverage to codecov (tokenless) + if: >- + github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name != github.repository + uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true + - name: Upload coverage to codecov (with token) + if: > + github.repository == 'TheAlgorithms/C-Sharp' && + (github.event_name != 'pull_request' || + github.event.pull_request.head.repo.full_name == github.repository) + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true