The failure message is direct: the file is not a Cobertura XML report, so upload a Cobertura XML report. This usually means the test tool produced another format such as LCOV, or the workflow pointed at the wrong file. The fix belongs in report generation, not in a retry loop around the upload step.
What Cobertura XML means here
Generate the right report
For Python, pytest-cov can write XML coverage directly. For JavaScript and TypeScript, Istanbul or nyc can use the Cobertura reporter. For Go, a tool such as gocover-cobertura can convert a coverprofile. For Java, use the JaCoCo to Cobertura conversion path documented by GitHub. The important check is the file format at the upload boundary, not the name of the test runner.
The workflow requirements
Use the right workflow triggers
For most repositories, run coverage on pull_request and on pushes to the default branch. The pull request run provides the review context, while the default branch establishes the comparison baseline. A broad push plus pull_request setup can run twice for the same commit, so choose the trigger strategy deliberately.
Handle fork pull requests safely
Pull requests from forks do not have write access to the base repository, so the coverage action cannot upload their report. Guard the upload step for fork pull requests, or use a workflow design that runs the upload only when the source repository is the same as the base repository. Let the tests run even when the upload is skipped.
Why valid reports may still need cleanup
GitHub also made processing more forgiving for valid Cobertura reports. Minor structural problems no longer reject the whole report, and individual lines without a usable line number or hit count are skipped. That helps imperfect reports, but it does not make a different format acceptable.
A quick debugging sequence
First confirm the file exists at the path passed to the action. Next identify its producer and configure that tool for Cobertura output. If conversion is required, validate the converted file before upload and keep the conversion step in the same job. Then check workflow permissions and fork conditions. Finally, open the pull request after a successful run and confirm that the coverage comment or result appears.
