Skip to content

Upload to Codecov with OIDC so Dependabot PRs can pass - #1819

Merged
tleonhardt merged 1 commit into
mainfrom
codecov-oidc-upload
Nov 16, 2026
Merged

tleonhardt merged 1 commit into
mainfrom
codecov-oidc-upload

Conversation

@tleonhardt

Copy link
Copy Markdown
Member

Problem

Every Dependabot PR fails the whole Tests matrix (currently #1818). The tests themselves pass; the
Upload coverage to Codecov step fails with:

Upload queued for processing failed: {"message":"Token required because branch is protected"}

GitHub does not give Actions secrets to workflow runs triggered by Dependabot, so
secrets.CODECOV_TOKEN is empty there. Codecov only accepts tokenless uploads from fork PRs, and
Dependabot branches live in this repository, so the upload is rejected and fail_ci_if_error: true
fails the job.

Fix

Authenticate the Codecov uploads with a short-lived GitHub OIDC token (use_oidc: true) instead of
the long-lived CODECOV_TOKEN secret. This needs id-token: write on the tests job; the
workflow-level default stays contents: read.

  • Dependabot runs can mint an OIDC token, so their uploads now authenticate.
  • Fork PRs behave as before: the action skips OIDC for forks and uses tokenless upload.
  • The CODECOV_TOKEN repository secret is no longer referenced by any workflow.

Verification

Dependabot-triggered workflow runs are not given GitHub Actions secrets, so
CODECOV_TOKEN was empty and Codecov rejected the upload with "Token required
because branch is protected". With fail_ci_if_error set, that failed every
job in the test matrix on every Dependabot PR.

Authenticate with a short-lived GitHub OIDC token instead, which needs no
secret and is available to Dependabot runs. Fork PRs are unaffected: the
action skips OIDC for forks and keeps using Codecov's tokenless upload.
@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.75%. Comparing base (0047276) to head (5b81458).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1819   +/-   ##
=======================================
  Coverage   99.75%   99.75%           
=======================================
  Files          23       23           
  Lines        6632     6632           
=======================================
  Hits         6616     6616           
  Misses         16       16           
Flag Coverage Δ
unittests 99.75% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@tleonhardt
tleonhardt merged commit 2a431f7 into main Nov 16, 2026
44 of 50 checks passed
@tleonhardt
tleonhardt deleted the codecov-oidc-upload branch November 16, 2026 17:34
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