@@ -92,25 +92,23 @@ jobs:
92
92
GO_MODULE_PATH : ${{ matrix.module.path }}
93
93
run : task go:test
94
94
95
- # A token is used to avoid intermittent spurious job failures caused by rate limiting.
96
- - name : Set up Codecov upload token
97
- run : |
98
- if [[ "${{ github.repository }}" == "arduino/pluggable-discovery-protocol-handler" ]]; then
99
- # In order to avoid uploads of data from forks, only use the token for runs in this repo.
100
- # Token is intentionally exposed.
101
- # See: https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954
102
- CODECOV_TOKEN="d2497f03-291d-4e0c-9d31-d94614ed7c16"
103
- else
104
- # codecov/codecov-action does unauthenticated upload if empty string is passed via the `token` input.
105
- CODECOV_TOKEN=""
106
- fi
107
- echo "CODECOV_TOKEN=$CODECOV_TOKEN" >> "$GITHUB_ENV"
108
-
109
95
- name : Send unit tests coverage to Codecov
110
- if : runner.os == 'Linux'
96
+ if : runner.os == 'Linux' && github.repository == 'arduino/pluggable-discovery-protocol-handler'
97
+ uses : codecov/codecov-action@v3
98
+ with :
99
+ # A token is used to avoid intermittent spurious job failures caused by rate limiting.
100
+ token : d2497f03-291d-4e0c-9d31-d94614ed7c16
101
+ file : ${{ matrix.module.path }}coverage_unit.txt
102
+ flags : ${{ matrix.module.codecov-flags }}
103
+ fail_ci_if_error : true
104
+
105
+ - name : Send unit tests coverage to Codecov (run from a fork)
106
+ if : runner.os == 'Linux' && github.repository != 'arduino/pluggable-discovery-protocol-handler'
111
107
uses : codecov/codecov-action@v3
112
108
with :
113
- token : ${{ env.CODECOV_TOKEN }}
109
+ # use repository variable CODECOV_TOKEN if running from a fork.
110
+ # codecov/codecov-action does unauthenticated upload if empty string is passed via the `token` input.
111
+ token : ${{ vars.CODECOV_TOKEN }}
114
112
file : ${{ matrix.module.path }}coverage_unit.txt
115
113
flags : ${{ matrix.module.codecov-flags }}
116
- fail_ci_if_error : ${{ github.repository == 'arduino/pluggable-discovery-protocol-handler' }}
114
+ fail_ci_if_error : false
0 commit comments