Codecov uses a YAML-style configuration methodology.
There are two primary locations for the Codecov YAML:
Global YAML: The global settings for your organization, accessible via your settings page in Codecov https://app.codecov.io/account/[gh/gl/bb]/[org_name]/yaml
Repository YAML: The repo level settings for each repo, set and held in your Github/Gitlab/Bitbucket. This YAML file must be a stand-alone file and is not part of your CI-level YAML.
If both the Global YAML AND the Repository YAML are set, the Repository-level YAML has priority.
Changing your Codecov YAML?
Changing your Codecov YAML? A reminder to always validate your Codecov YAML before you deploy https://api.codecov.io/validate
Looking for all possible YAML configurations?
See the full codecov.yml Reference page.
Codecov provides a user interface to adjust a "Global YAML", which overrides the default settings in Codecov. It is applied to all repositories in the Global. Only Global administrators can adjust the Global YAML in Codecov. All changes are stored in history.
The most common use for the Global YAML is to set up a Codecov Bot account and adding custom CI services. The global yaml can only be updated by an admin and cannot accept comments, it will validate any non admin and comment changes out when the yaml is saved.
Example of Global YAML in settings page
Each repository may have their own unique Codecov YAML. The contents of the Repository YAML are stored in a file, checked into
git/hg within the root of your repo.
All configurations in the Repository YAML will override the Global YAML. The Global YAML is not replaced, but updated with the Repository YAML. You can view your current repo yaml in the settings page of your repo, it is not editable here and must be changed within your code host to update.
# Global YAML [lower on hierarchy]
# Repository YAML [higher on hierarchy]
# Used in Codecov after updating
Looking to pass or fail a pull request / merge request based on coverage?
Please see our "Commit Status" feature for passing or failing a pull request based on code coverage thresholds
Validate your repository YAML by posting the content to Codecov for analysis.
curl --data-binary @codecov.yml https://codecov.io/validate
# PowerShell Sample
Invoke-RestMethod -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post
NOTE: This YAML validator is specific to the codecov.yml file. This will not validate your CI-level YAML that you use to upload to codecov.
Validation response codes.
A quick way to determine if the YAML validated against this endpoint is to check the response code. An invalid YAML will return a status code of 400, instead of the normal 200 success.
Codecov will use the default branch from Git for your repository as the primary source of the repositories' Codecov.yml.
You can change the Codecov default branch in your YAML.
branch: stable # set new Default branch
The default branch is used to identify:
- Which branch to cache the repository YAML for UI changes.
- Which branch is the first branch on the repository dashboard in Codecov.
Codecov will always use the current YAML on the branch being tested by default. If you would like to restrict changes to the YAML, and always use the YAML on a specific branch, you may declare the branch as shown below.
For example: you may be changing the Codecov YAML on a feature branch to test out Codecov features but want the Codecov configuration to always reference the default branch
strict_yaml_branch: default # only use the latest YAML on stated branch
Codecov will reject reports that are over 12 hours old according to the timestamp in the report. This is to prevent reports that may have been accidently checked into
To disable this functionality please add the following to your
If you would like to change the amount of time of default:
max_report_age: '12h' #equates to 12 hours
#max_report_age can be listed in hours '#h' (hours) or '#d' (days)
Yes. However, the file must still be located in the repository root,
The Codecov YAML file is the single-point of configuration, providing the developers with a transparent and version controlled file to adjust all Codecov settings.
No. However, if you need to customize your project in Codecov, or add new notifications, then the YAML is required.
Head over to your repository settings page; click the YAML tab. You will find the Create new secret string section in the UI. Information on how to create and use these strings is found in the app.
There are several reasons why the bot specified does not match the one in use:
The YAML in your repo is invalid. If you included the bot username in a repository-level YAML, please follow the steps here to determine if this repository-level YAML is valid.
You might also want to consider setting a bot in the organization-level YAML so it's easier to see what’s going wrong.
The bot is not part of the organization. For a team bot to work, it must be part of the organization your repositories live in.
The bot was not granted access to the repository you have. To resolve, simply login to Codecov as the bot.
The bot's access token has expired. To resolve, log into Codecov again as the bot and grant permission.
There are three possible reasons why the YAML you see in the Current repository yaml section of the
/settings/yaml page does not match the one you see in your repo:
The YAML in your repo is invalid. When the repoistory-level YAML is invalid, we keep using the last valid YAML provided. To determine whether your YAML is valid, please follow the steps here.
The repository-level YAML is not in what Codecov considers the default branch. If the YAML is in a feature branch, you should be able to see it in Current repository YAML section of the
/settings/yamlpage after merging the feature branch into the default branch. You can identify the default branch in the _Default Branch section of the
Codecov was unable to fetch the new YAML from the repo. This usually happens when the bot user you use (more info) or the provider integration you installed does not have access to the repository in your provider (i.e. GitHub, GitLab, etc). It's also possible you unintentionally specified the wrong bot user.
Updated about 1 month ago