Repository navigation
Conversation
The test job uploads coverage with codecov/codecov-action but supplies no token, and tokenless uploads are only accepted for unprotected branches: the action prefixes a branch with the fork owner only for cross-repository PRs. For a push to master, or for a PR opened from a branch in this repository, Codecov resolves the upload to the protected default branch and rejects it with "Token required because branch is protected". Those rejections have been invisible because fail_ci_if_error defaults to false. The runs for #643 and for the last push to master show all three calls failing that way while the job stays green. Request an id-token and let the action exchange it for a short-lived Codecov token instead. Fork PRs cannot obtain an id-token, so the action skips OIDC for them and they keep using Codecov's tokenless path. fail_ci_if_error is now set so a rejected upload fails the job rather than passing quietly. Signed-off-by: Fred Bricon <fbricon@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #644 +/- ##
==========================================
- Coverage 25.85% 24.67% -1.18%
==========================================
Files 4 4
Lines 294 308 +14
Branches 55 61 +6
==========================================
Hits 76 76
- Misses 218 232 +14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
A rejected upload or a Codecov outage should not turn the test job red. The step keeps use_oidc and id-token: write, which is what replaces the long-lived token; the upload result still shows up in the step log. Signed-off-by: Fred Bricon <fbricon@gmail.com>
Contributor
Author
|
On the red check: The two legs that do reach it (macOS and Windows) upload fine with the OIDC token: And Codecov uploads no longer fail the build: |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Coverage uploads in this repo are silently rejected.
codecov/codecov-actionis called without a token, and Codecov only accepts tokenless uploads for unprotected branches — the action adds theowner:branchprefix only for cross-repository PRs. A push tomaster, or a PR from a branch in this repository, resolves to the protected default branch, and the upload is refused:That happens three times (commit, report, upload) on the run for #643, and also on the last push to
master, while the job stays green becausefail_ci_if_errordefaults tofalse.Fix: request
id-token: writeon the test job and let the action exchange it for a short-lived Codecov token (use_oidc: true). Nothing is stored, nothing needs rotating. Fork PRs cannot obtain an id-token, so the action skips OIDC for them and they keep using Codecov's tokenless path exactly as today.Uploads stay non-blocking:
fail_ci_if_erroris left at its default (false), so a Codecov outage never turns a PR red.file:→files:because that is the input name in current codecov-action v4; the old one is deprecated.Validated with
actionlint1.7.12.Note: this touches the same workflow as #643 (trusted publishing), so whichever lands second needs a rebase.