The Codecov pull request comment is a highly detailed overview of a pull request. It provides details on the coverage changes in the pull request that help with speeding up code review, and ensuring that pull requests are well tested. The comment is customizable to fit your desired needs.
It is important to understand what
absolute <relative> (impact) represents. Learn all about the Codecov Delta.
To disable the comment, simply set the comment to false in your
codecov.yml, as shown below.
You can do this in your Team Yaml, to take effect on all your repositories.
comment layout"reach, diff, flags, files" behaviordefault require_changesfalse # if true: only post the comment if coverage changes require_baseno # [yes :: must have a base report to post] require_headyes # [yes :: must have a head report to post] branchesnull # branch names that can post comment after_n_builds<number> #e.g., 5. The number of uploaded reports codecov will receive before posting a comment on a pull request.
Customize your comment layout by choosing the order and types of components to include. Below is an example of a layout for
reach, diff, flags, files.
- Reach is a coverage graph embedded into the comment.
- Learn more here: Graphs: Reach.
- Diff is the Coverage Diff of the pull request.
- Learn more here: Coverage Diff.
- Flags are a list of user defined Flags, and the impact on their coverage
- Learn more about setting up Flags.
- Files are a list of files that are impacted by the pull request (coverage changes, file is new or removed).
Choose the way Codecov submits comments in your pull requests.
default: update, if exists. Otherwise post new.
once: update, if exists. Otherwise post new. Skip if deleted.
new: delete old and post new.
spammy: post new (do not delete old comments).
When updating, the creation date of the comment will stay the same. There will be an
edited link with a drop-down where you can check the times updated.
Emails will be submitted to all subscribers of the pull request only when posting a new comment. There is no way to disable email notifications. This is a limitation of the Supported CI Providers.
You may desire to change when the comment is posted, if any changes are discovered in coverage.
Comments will now only post when coverage changes. Furthermore, if a comment already exists, and a newer commit results in no coverage change for the entire pull, the comment will be deleted.
You can force comments to post on pull requests even if Codecov doesn't have coverage reports for either the base or head commit. This generally isn't recommended since, without base and head coverage report information, the resulting comment is not very helpful.
However, setting both
no can allow you to test the ability of Codecov to post a comment to your pull requests without needing to upload coverage for both the base and head commit.
comment require_headno # default yes require_baseno # default yes
The branches section allows you to specify which branch(es) the comment is allowed to comments to. For example, specifying
master means the comment will only post when the branch of the PR head is
You can also negate branches by using
!<branch-name>. This will prevent codecov from posting on the specified branch.
comment branch!develop # never post comments if the PR head is on the develop branch
By default codecov will post and/or update the pull request comment after it processes each report uploaded for a particular pull request commit. If your CI process uploads many reports to codecov, this can be confusing for team members viewing the pull request as reports are processing.
To remedy this, you can delay the posting of a pull request comment until a certain number of reports are received and processed by Codecov, using the
Generally, you should set
after_n_builds equal to the number of reports you upload per commit. However, this is not required. If
after_n_builds is greater than the number of reports you upload for a commit, no comment will post. If it is less, the comment will post when
after_n_builds is reached and (by default) continue to update on each additional report upload.
Updated 2 months ago
It is important to learn about the Codecov Delta syntax to fully understand pull request comments.