Skip to content

Commit 8b923b5

Browse files
committed
1 parent 9f46e33 commit 8b923b5

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

.github/workflows/test-go-task.yml

+15-1
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,25 @@ jobs:
9696
GO_MODULE_PATH: ${{ matrix.module.path }}
9797
run: task go:test
9898

99+
# A token is used to avoid intermittent spurious job failures caused by rate limiting.
100+
- name: Set up Codecov upload token
101+
run: |
102+
if [[ "${{ github.repository }}" == "arduino/arduino-create-agent" ]]; then
103+
# In order to avoid uploads of data from forks, only use the token for runs in the arduino/arduino-create-agent repo.
104+
# Token is intentionally exposed.
105+
# See: https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954
106+
CODECOV_TOKEN=fe64847a-368e-4f95-9212-1f7a6835043f
107+
else
108+
# codecov/codecov-action does unauthenticated upload if empty string is passed via the `token` input.
109+
CODECOV_TOKEN=""
110+
fi
111+
echo "CODECOV_TOKEN=$CODECOV_TOKEN" >> "$GITHUB_ENV"
112+
99113
- name: Send unit tests coverage to Codecov
100114
if: runner.os == 'Linux'
101115
uses: codecov/codecov-action@v4
102116
with:
103-
token: ${{ secrets.CODECOV_TOKEN }}
117+
token: ${{ env.CODECOV_TOKEN }}
104118
files: ${{ matrix.module.path }}coverage_unit.txt
105119
flags: ${{ matrix.module.codecov-flags }}
106120
fail_ci_if_error: ${{ github.repository == 'arduino/arduino-create-agent' }}

0 commit comments

Comments
 (0)