Coverage upload to Codecov fails on `main` branch

Open Beginner friendly
#623 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
github-actions
Domain
ci-cd

Research direction

Start with the coverage upload job in the linked GitHub Actions run and review the Codecov token guidance linked in the issue. Configure the repository token for uploads from the protected main branch, then verify that the job succeeds and pull-request coverage reports no longer omit executed lines.

Written by the indexing model from the issue text.

Description

It looks like coverage upload is failing on the main branch because a token is not configured. For example, coverage upload in this job (https://github.com/xarray-contrib/cf-xarray/actions/runs/23146050340/job/67234365718) failed with:

error - 2026-03-16 13:27:53,656 -- Upload failed: {"message":"Token required because branch is protected"}

This results in inaccurate coverage reports on pull requests, e.g. https://github.com/xarray-contrib/cf-xarray/pull/622#issuecomment-4126762199, where lines are reported as missing coverage, while they are in fact executed when running the tests.

This issue can likely be solved by setting up a Codecov token for this repository. See https://docs.codecov.com/docs/codecov-tokens for further info.

Dominant language
Python
Stars
181
Forks
49
Avg merge
43m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from xarray-contrib/cf-xarray

All issues in xarray-contrib/cf-xarray

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.