Skip to content

fix: skip the codecov upload when the run has no token - #17

Merged
paqstd-dev merged 1 commit into
mainfrom
ci-codecov-dependabot
Sep 6, 2026
Merged

fix: skip the codecov upload when the run has no token#17
paqstd-dev merged 1 commit into
mainfrom
ci-codecov-dependabot

Conversation

@paqstd-dev

Copy link
Copy Markdown
Owner

Both open Dependabot pull requests, #15 and #16, fail every test job while lint, typecheck, docs, build and audit pass.
The suite itself is green there, 1147 passed and 4 skipped on each Python version.
What fails is the step after it.

-> Token length: 0
error -- Upload queued for processing failed: {"message":"Token required because branch is protected"}
==> Failed to run upload-coverage

A workflow run triggered by Dependabot gets no Actions secrets, so secrets.CODECOV_TOKEN resolves to an empty string, codecov declines a tokenless upload into a protected branch, and fail_ci_if_error turns that into a red job.
These are the first Dependabot pull requests the repository has had, so it had never come up.

The token now reaches the step through the job environment, because a step if cannot read the secrets context, and the upload is skipped when the token is absent.
Runs on main and on a branch in this repository are unchanged and still upload under fail_ci_if_error.
A pull request from a fork stops failing for the same reason.

Nothing is lost on a skipped run.
The coverage gate is the coverage report step that follows, and fail_under = 100 enforces it there regardless of codecov, which only supplies the dashboard and the pull request comment.

The documented alternative is adding the token as a Dependabot secret, which is what the codecov action recommends, and it would upload from those runs too.
It is not taken here because it hands an upload token to the one class of pull request that builds and executes third party code, and it does nothing for forks.

make audit is clean.

🤖 Generated with Claude Code

A Dependabot pull request runs without access to Actions secrets, so the
upload token arrived empty and codecov refused a tokenless upload into a
protected branch. With fail_ci_if_error the whole test job went red on
every Python version while the suite itself passed, which is what both
open dependency bumps were failing on.

The token now reaches the step through the job environment, because a
step if cannot read the secrets context, and the step is skipped when it
is absent. Runs on main and on a branch in this repository upload exactly
as before, and a pull request from a fork stops failing for the same
reason. Nothing is lost on the skipped runs, since the coverage gate is
the coverage report step that follows and it enforces the full hundred
percent on its own.
@paqstd-dev
paqstd-dev merged commit 0038850 into main Sep 6, 2026
13 checks passed
@paqstd-dev
paqstd-dev deleted the ci-codecov-dependabot branch September 6, 2026 17:49
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