Repository navigation
ci: don't fail Codecov upload when the token is unavailable - #312
Conversation
Dependabot and fork PR runs don't receive repository secrets, so CODECOV_TOKEN is empty and the upload is rejected. Only set fail_ci_if_error when the token is present. Also let Dependabot update uv.lock weekly, grouped into one PR.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 59ba345049
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| fail_ci_if_error: true # optional (default = false) | ||
| # NOTE: Dependabot and fork PRs get no secrets, so the upload cannot succeed there; | ||
| # fail only when the token is present. | ||
| fail_ci_if_error: ${{ secrets.CODECOV_TOKEN != '' }} |
There was a problem hiding this comment.
Exclude Dependabot from the coverage-comment job
On a Dependabot PR without CODECOV_TOKEN, this allows build to succeed, which makes the later post job eligible because Dependabot's branch belongs to the same repository. However, GitHub forces Dependabot-triggered pull_request runs to use a read-only GITHUB_TOKEN, while orgoro/coverage requires pull-requests: write to post its comment. That job will therefore fail instead, leaving the Dependabot workflow red; exclude dependabot[bot] from post or make the comment step non-blocking for that actor.
Useful? React with 👍 / 👎.
☂️ Code Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Dependabot pull_request runs get a read-only GITHUB_TOKEN, so posting the coverage comment would fail now that the build job passes.
Problem
Every Dependabot PR fails the
test (ubuntu-latest, 3.12)job at Upload Coverage to Codecov withToken required because branch is protected(example run). The tests themselves pass.Root cause: GitHub doesn't expose repository Actions secrets to Dependabot-triggered (or fork) runs, so
secrets.CODECOV_TOKENis empty, Codecov rejects the upload, andfail_ci_if_error: trueturns that into a job failure.Change
ci.yml:fail_ci_if_error: ${{ secrets.CODECOV_TOKEN != '' }}. Runs without the token log the Codecov error and continue; normal runs with the token still fail loudly on real Codecov errors. The coverage artifact upload is unchanged.ci.yml: skip thepostcoverage-comment job whengithub.actorisdependabot[bot]. Dependabotpull_requestruns get a read-onlyGITHUB_TOKEN, so the comment would fail now thatbuildpasses (flagged by Codex review).dependabot.yml: add theuvecosystem (weekly, all updates grouped into one PR).No CHANGELOG entry since this is CI-only and not user-visible.
Checked with actionlint and the pre-commit YAML/whitespace/codespell hooks.
Made with Claude Code.
Alternative/complement: adding
CODECOV_TOKENas a Dependabot secret (Settings → Secrets and variables → Dependabot) would also restore coverage uploads on Dependabot PRs.