Difference between branch and branches for badges

Before submitting a topic, please confirm the following

I have searched for similar issues before creating this topic.
I have verified that my repository is using the Codecov GitHub app, if using GitHub
I have validated my codecov.yaml configuration file.
I have filled out the below sections to the best of my ability.


Hi, for some reason my shields.io badge does not display the correct coverage percentage (see issue on GitHub: Wrong percentage for codecov · Issue #8545 · badges/shields · GitHub)

chris48s reported that there is a difference of percentage between these two badge URLs (badges from codecov, not shields.io):

Any reason why this happens?


Codecov Output

==> SHASUM file signed by key id 806bb28aed779869
==> Uploader SHASUM verified (20f9c9d78483fce977b6cc39e231a734a23bcd36f4d536bb7355222fb88d02bc  codecov)
==> Running version latest
==> Running version v0.3.2
/home/runner/work/_actions/codecov/codecov-action/v3/dist/codecov -n  -Q github-action-3.1.1
[2022-10-18T14:02:03.424Z] ['info'] 
     _____          _
    / ____|        | |
   | |     ___   __| | ___  ___ _____   __
   | |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
   | |___| (_) | (_| |  __/ (_| (_) \ V /
    \_____\___/ \__,_|\___|\___\___/ \_/

  Codecov report uploader 0.3.2
[2022-10-18T14:02:03.435Z] ['info'] => Project root located at: /home/runner/work/core-bundle/core-bundle
[2022-10-18T14:02:03.436Z] ['info'] -> No token specified or token is empty
[2022-10-18T14:02:03.445Z] ['info'] Searching for coverage files...
[2022-10-18T14:02:03.543Z] ['info'] Warning: Some files located via search were excluded from upload.
[2022-10-18T14:02:03.543Z] ['info'] If Codecov did not locate your files, please review https://docs.codecov.com/docs/supported-report-formats
[2022-10-18T14:02:03.543Z] ['info'] => Found 1 possible coverage files:
[2022-10-18T14:02:03.544Z] ['info'] Processing /home/runner/work/core-bundle/core-bundle/coverage.xml...
[2022-10-18T14:02:03.570Z] ['info'] Detected GitHub Actions as the CI provider.
[2022-10-18T14:02:03.572Z] ['info'] Pinging Codecov: https://codecov.io/upload/v4?package=github-action-3.1.1-uploader-0.3.2&token=*******&branch=4.x&build=3274101549&build_url=https%3A%2F%2Fgithub.com%2Fleapt%2Fcore-bundle%2Factions%2Fruns%2F3274101549&commit=96fc94c147ec997847479bea67619b05c95cecc4&job=Continuous+Integration&pr=&service=github-actions&slug=leapt%2Fcore-bundle&name=&tag=&flags=&parent=
[2022-10-18T14:02:04.268Z] ['info'] https://app.codecov.io/github/leapt/core-bundle/commit/96fc94c147ec997847479bea67619b05c95cecc4
[2022-10-18T14:02:04.268Z] ['info'] Uploading...
[2022-10-18T14:02:04.509Z] ['info'] {"status":"success","resultURL":"https://app.codecov.io/github/leapt/core-bundle/commit/96fc94c147ec997847479bea67619b05c95cecc4"}

Expected Results

I’d expect the same percentage (47%) to appear on both badge URLs

Actual Results

There a percentage difference between the two badges:

Additional Information


@jmsche branch is correct. branches ignores the 4.x and defaults to your default branch, in this case master. You can see the last commits show 25.74% coverage.

Thanks for the information. Just switched the main branch to 4.x and I get the correct percentage.

1 Like