Skip to content

ci: don't fail Codecov upload when the token is unavailable - #312

Merged
rafaelha merged 2 commits into
mainfrom
ci/codecov-dependabot
Nov 26, 2026
Merged

rafaelha merged 2 commits into
mainfrom
ci/codecov-dependabot

Conversation

@rafaelha

@rafaelha rafaelha commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Every Dependabot PR fails the test (ubuntu-latest, 3.12) job at Upload Coverage to Codecov with Token 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_TOKEN is empty, Codecov rejects the upload, and fail_ci_if_error: true turns 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 the post coverage-comment job when github.actor is dependabot[bot]. Dependabot pull_request runs get a read-only GITHUB_TOKEN, so the comment would fail now that build passes (flagged by Codex review).
  • dependabot.yml: add the uv ecosystem (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_TOKEN as a Dependabot secret (Settings → Secrets and variables → Dependabot) would also restore coverage uploads on Dependabot PRs.

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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T04:32:38.336495Z 59ba345 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread .github/workflows/ci.yml
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 != '' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

☂️ Code Coverage

current status: ✅

Overall Coverage

Statements Covered Coverage Threshold Status
7221 6197 86% 0% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: a8a9fbe by action🐍

@codecov

codecov Bot commented Nov 26, 2026

Copy link
Copy Markdown

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.
@rafaelha
rafaelha merged commit cd8b13d into main Nov 26, 2026
12 checks passed
@rafaelha
rafaelha deleted the ci/codecov-dependabot branch November 26, 2026 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant