From 835f4bdabc40d5751efda31c9193ef07b8b7c1d0 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Mon, 3 Oct 2022 22:44:51 +0200 Subject: [PATCH] CI: Fix Codecov intermittently failing on coverage report upload The patch explicitly adds the use of the `with.token` option, as confirmed by others to improve the behaviour even on public repos. The token is not required for public repos, but it makes the workflow less likely to randomly fail because of a limit in codecov CI capabilities [1]. The secret token doesn't always save from false positives though, because GitHub Actions are supposedly buggy when handling secrets [2-4]. [1] https://github.com/codecov/codecov-action/issues/557#issuecomment-1216749652 [2] https://github.com/codecov/codecov-action/issues/557#issuecomment-1223737955 [3] https://github.com/codecov/codecov-action/issues/598#issuecomment-1223307820 [4] https://github.com/orgs/community/discussions/25701 --- .github/workflows/tests.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 984db8ee..63f9c0e4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -54,4 +54,18 @@ jobs: - name: Upload coverage results to Codecov uses: codecov/codecov-action@v3 with: + + # The token is not required for public repos, but it makes the workflow + # less likely to randomly fail because of a limit in codecov CI + # capabilities [1]. + # + # The secret token doesn't always save from false positives though, + # because GitHub Actions are supposedly buggy when handling secrets [2-4]. + # + # [1] https://github.com/codecov/codecov-action/issues/557#issuecomment-1216749652 + # [2] https://github.com/codecov/codecov-action/issues/557#issuecomment-1223737955 + # [3] https://github.com/codecov/codecov-action/issues/598#issuecomment-1223307820 + # [4] https://github.com/orgs/community/discussions/25701 + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true