Skip to content

Commit 2889e04

Browse files
committed
workflows: Tweak oidc auth for codecov
Currently codecov step succeeds in main and in PRs from forks, but fails in PRs from origin. This seems to be a codecov bug but I believe we can tweak the workaround. * Always run the auth workaround step * Only try to set the codecov token if OIDC is available This should mean that: * PRs from forks will not have auth token: that works fine * pushes to main will have auth token * PRs from origin repo will have auth token (even though they should not need it) Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
1 parent 82230be commit 2889e04

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
- name: Run Go tests
8484
run: go test -covermode atomic -coverprofile coverage.txt $(go list ./... | grep -v third_party/)
8585
- name: Workaround buggy Codecov OIDC auth
86-
if: github.event_name == 'push'
86+
if: env.ACTIONS_ID_TOKEN_REQUEST_TOKEN != ''
8787
run: |
8888
TOKEN_RESPONSE=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=https://codecov.io")
8989
CODECOV_TOKEN=$(echo $TOKEN_RESPONSE | jq -r .value)

0 commit comments

Comments
 (0)