Codecov badge reports coverage percentage from merge request instead of master branch


I have an unmerged PR on my GitLab repo that currently reduces my test coverage by about 20% compared to my master branch. The CI is generating coverage reports for commits on this PR and uploading them to codecov as expected. However, the badge on my repo is now reporting the reduced percent coverage from this most recent commit on the PR rather than coverage for the most recent commit on the master branch.



GitLab CI


Python uploader

Commit SHAs

most recent PR commit that the badge seems to be displaying coverage for: 250bcbc6ab7df98256ffbfe1d394affb22166d25
most recent commit on master that I expect the badge to display coverage for: 0e9b5cdbada11c44b3d14b666a75564d87514c2b

Codecov YAML

  token: xxxx

Codecov Output

This is the output from codecov from the CI running on the unmerged PR:

$ codecov
      _____          _
     / ____|        | |
    | |     ___   __| | ___  ___ _____   __
    | |    / _ \ / _  |/ _ \/ __/ _ \ \ / /
    | |___| (_) | (_| |  __/ (_| (_) \ V /
     \_____\___/ \____|\___|\___\___/ \_/
==> Detecting CI provider
    Gitlab CI Detected
==> Preparing upload
==> Processing gcov (disable by -X gcov)
==> Collecting reports
    + /builds/gchintzo/aiapy/aiapy/tests/coveragerc bytes=767
    + /builds/gchintzo/aiapy/.tmp/py37-online/coverage.xml bytes=19135
==> Uploading
    .query commit=250bcbc6ab7df98256ffbfe1d394affb22166d25&branch=master&token=<secret>&service=gitlab&build=608854822&slug=gchintzo%2Faiapy&yaml=.codecov.yml&package=py2.1.7
    Gzipping contents..
    Compressed contents to 2700 bytes
    Pinging Codecov...
    Uploading to S3...
Job succeeded

Steps to Reproduce

Expected behavior: Badge will report coverage for most recent commit on master branch

Actual behavior: Badge reports coverage for most recent merge request commit

Flakiness? This happens all of the time

Additional Information

The URLs I’m using to display the badge on the repo are:

image link:

Hi @wtbarnes, thanks for this info here, I’ve escalated to the product team to take a look.

Hi @wtbarnes, just an update that we are still taking a look at this. Thanks for your patience here.

Hi @wtbarnes, just wanted you to know that we are still looking into a fix for this. Thanks for your patience.

Thanks for following up Tom! I actually have noticed that the issue seems to be fixed in my case though I’m not sure what changed. The last time I submitted a PR that increased the test coverage, the badge seemed to still report the coverage on the master branch.

1 Like