GitHub code coverage now rejects non-Cobertura reports
Since 23 November 2026, GitHub Code Quality's actions/upload-code-coverage action checks that the uploaded file is Cobertura XML and fails the step if it isn't. Uploads in other formats, such as LCOV, used to appear to succeed while showing no coverage on pull requests. Fix it by making your test tool emit Cobertura XML or converting the report first.
GitHub changed how its Code Quality coverage upload handles bad input. As of 23 November 2026, the actions/upload-code-coverage action checks that your report is Cobertura XML, and the upload step fails if it isn't. Until now, a report in another format looked like a successful upload, but no coverage ever appeared on pull requests. If a CI job started going red today with a message about Cobertura, this is why, and the fix is usually one flag in your test command.
What changed
The new check lives in the upload step. When the file is not Cobertura XML, the Actions log shows:
This file is not a Cobertura XML report. Upload a Cobertura XML report.The failure replaces a silent one. Teams that uploaded LCOV, JaCoCo XML or Go's native cover profile were getting nothing on their pull requests and might not have noticed.
The change also goes the other way for valid files. GitHub says Cobertura reports are now handled more leniently: minor structural issues no longer cause rejection, and individual lines without a usable line number or hit count are skipped rather than the whole report being discarded.
It applies to GitHub Team and GitHub Enterprise Cloud, including Enterprise Cloud with data residency. It does not apply to GitHub Enterprise Server. Coverage needs GitHub Code Quality enabled for the repository.
How the coverage upload works
The setup guide describes a workflow that runs tests, writes a Cobertura file and uploads it. The upload action takes three inputs: file (the report path), language (the primary language) and label (a name for this report, such as code-coverage/pytest). The job needs contents: read and code-quality: write.
Here is GitHub's Python example, condensed:
name: Code Coverage
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
code-quality: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov
- name: Run tests with coverage
run: pytest --cov=. --cov-report=xml
- name: Upload coverage report
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
uses: actions/upload-code-coverage@v1
with:
file: coverage.xml
language: Python
label: code-coverage/pytestThree details in that file are easy to get wrong:
- Both
pushandpull_requesttriggers are needed. Code Quality compares pull request coverage with the default branch, so the default branch needs uploads too. - Check out the head commit, not the merge commit. The
refline makes coverage line numbers map onto the pull request diff. - The
ifcondition skips forked pull requests, which don't get the write permission.
Results appear as a comment from github-code-quality[bot] on each pull request, with line coverage for the branch against the default branch and a per-file breakdown.
Producing Cobertura XML from your test tool
GitHub's guide lists commands for five ecosystems. Most other test runners can also write Cobertura directly.
| Language | Tool | How to get Cobertura XML |
|---|---|---|
| Python | pytest-cov | pytest --cov=. --cov-report=xml (writes coverage.xml) |
| JavaScript/TypeScript | Istanbul / nyc | nyc report --reporter=cobertura |
| Java | JaCoCo | Convert with cover2cover.py or a JaCoCo-to-Cobertura Gradle or Maven plugin |
| Ruby | SimpleCov | Use SimpleCov::Formatter::CoberturaFormatter |
| Go | go test | go test -coverprofile=cover.out ./... then gocover-cobertura < cover.out > coverage.xml |
Some common runners not in GitHub's table:
- Jest uses Istanbul reporters, so add
coberturatocoverageReportersin your Jest config. The file lands incoverage/cobertura-coverage.xmlby default. - Vitest supports the same reporter: set
coverage.reporterto include'cobertura'. - .NET with the coverlet collector:
dotnet test --collect:"XPlat Code Coverage"writes acoverage.cobertura.xmlunderTestResults/<guid>/. The GUID changes on each run, so use a glob or a step that finds the file. - PHPUnit has a
--coverage-cobertura <file>option. - Rust with cargo-llvm-cov:
cargo llvm-cov --cobertura --output-path coverage.xml.
Check the exact flags against the version you run; reporter names and default output paths do change between major versions.
If you already produce LCOV for another service and don't want to change the test command, convert the file in a separate step before the upload instead. Converters such as the lcov_cobertura Python package do this. Keep the original LCOV step if something else consumes it.
To build the YAML for your stack, use the Cobertura coverage workflow generator. It writes the test command and upload step for common runners, with the permissions and triggers above.
What to check today
- Search your workflows for
actions/upload-code-coverageand check what eachfile:input points at. Anything ending in.info,lcov,.outorjacoco.xmlis almost certainly not Cobertura. - Look at recent pull requests. If the coverage comment from
github-code-quality[bot]never appeared, your uploads were probably being ignored before this change. - Open the file. A Cobertura report is XML with a root
<coverage>element containing<packages>and<classes>. JaCoCo XML has a<report>root, so the two are easy to tell apart. - Make monorepo labels distinct. If several jobs upload reports, give each a different
label, such ascode-coverage/api-pytestandcode-coverage/web-jest. - Mind required checks. If you use the Restrict code coverage rule, GitHub's guide says each status check tied to a coverage upload must be a required status check.
If CI failures like this land on a busy team, they tend to sit until someone has time. One option is to route CI failure alerts into your tooling automatically. CodeBeast automations, for example, give you a webhook URL that a CI job can post to, and each delivery becomes a task on the board.
Sources
- GitHub Changelog: Code coverage uploads now flag invalid report formats
- GitHub Docs: Set up code coverage
FAQ
Why does my GitHub coverage upload fail with "This file is not a Cobertura XML report"?
Since 23 November 2026, actions/upload-code-coverage validates the report format and fails on anything that isn't Cobertura XML. Configure your test tool to emit Cobertura, or convert the report before the upload step.
Does GitHub Code Quality support LCOV coverage reports?
No. Only Cobertura XML is supported, and LCOV is rejected. Convert LCOV to Cobertura with a converter such as the lcov_cobertura package, or switch your test runner's reporter to Cobertura.
Is this change available on GitHub Enterprise Server?
No. It applies to GitHub Team and GitHub Enterprise Cloud, including Enterprise Cloud with data residency. Coverage also requires GitHub Code Quality to be enabled on the repository.
How do I generate Cobertura XML with Jest?
Add cobertura to the coverageReporters array in your Jest configuration and run Jest with coverage enabled. By default the report is written to coverage/cobertura-coverage.xml, which you pass as the file input.
Written by the CodeBeast Team with AI assistance. Spotted a mistake? Email support@codebeast.ai.