Skip to content

Commit 56ba31f

Browse files
committed
[CI] use codecov token
1 parent e505786 commit 56ba31f

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

.github/workflows/unit-tests.yml

+17-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
steps:
2525
- name: Checkout
26-
uses: actions/checkout@v2
26+
uses: actions/checkout@v4
2727

2828
- uses: arduino/cpp-test-action@main
2929
with:
@@ -36,10 +36,23 @@ jobs:
3636
- '/usr/*'
3737
coverage-data-path: ${{ env.COVERAGE_DATA_PATH }}
3838

39+
# A token is used to avoid intermittent spurious job failures caused by rate limiting.
40+
- name: Set up Codecov upload token
41+
run: |
42+
if [[ "${{ github.repository }}" == "arduino-libraries/Arduino_CloudUtils" ]]; then
43+
# In order to avoid uploads of data from forks, only use the token for runs in the parent repo.
44+
# Token is intentionally exposed.
45+
# See: https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954
46+
CODECOV_TOKEN="8118de48-b2af-48b4-a66a-26026847bfc5"
47+
else
48+
# codecov/codecov-action does unauthenticated upload if empty string is passed via the `token` input.
49+
CODECOV_TOKEN=""
50+
fi
51+
echo "CODECOV_TOKEN=$CODECOV_TOKEN" >> "$GITHUB_ENV"
52+
3953
- name: Upload coverage report to Codecov
40-
uses: codecov/codecov-action@v1
54+
uses: codecov/codecov-action@v3
4155
with:
4256
file: "${{ env.COVERAGE_DATA_PATH }}"
4357
fail_ci_if_error: true
44-
45-
58+
token: ${{ env.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)