codecov/codecov-action@v7

GitHub Action that uploads coverage reports for your repository to codecov.io

At a glance

Latest major
v7
Repository
codecov/codecov-action
Inputs
50 (0 required)
Outputs
0
Runs using
composite
License
MIT
Last checked

Inputs and outputs come straight from the action's official action.yml. See our editorial standards.

Usage

- uses: codecov/codecov-action@v7

Inputs

NameRequiredDefaultDescription
base_shaNononeThe base SHA to select. This is only used in the "pr-base-picking" run command
binaryNononeThe file location of a pre-downloaded version of the CLI. If specified, integrity checking will be bypassed.
cleanupNofalseIf true, download the CLI into a temporary directory and clean it up after the run. Off by default to preserve legacy behavior of downloading into the current working directory.
codecov_yml_pathNononeThe location of the codecov.yml file. This is crrently ONLY used for automated test selection (https://docs.codecov.com/docs/getting-started-with-ats). Note that for all other cases, the Codecov yaml will need to be located as described here: https://docs.codecov.com/docs/codecov-yaml#can-i-name-the-file-codecovyml
commit_parentNononeSHA (with 40 chars) of what should be the parent of this commit.
directoryNononeFolder to search for coverage files. Default to the current working directory
disable_file_fixesNofalseDisable file fixes to ignore common lines from coverage (e.g. blank lines or empty brackets). Read more here https://docs.codecov.com/docs/fixing-reports
disable_searchNofalseDisable search for coverage files. This is helpful when specifying what files you want to upload with the files option.
disable_safe_directoryNofalseDisable setting safe directory. Set to true to disable.
disable_telemNofalseDisable sending telemetry data to Codecov. Set to true to disable.
dry_runNofalseDon't upload files to Codecov
env_varsNononeEnvironment variables to tag the upload with (e.g. PYTHON | OS,PYTHON)
excludeNononeComma-separated list of folders to exclude from search.
fail_ci_if_errorNofalseOn error, exit with non-zero code
filesNononeComma-separated list of explicit files to upload. These will be added to the coverage files found for upload. If you wish to only upload the specified files, please consider using disable_search to disable uploading other files.
flagsNononeComma-separated list of flags to upload to group coverage metrics.
forceNononeOnly used for empty-upload run command
git_serviceNogithubOverride the git_service (e.g. github_enterprise)
gcov_argsNononeExtra arguments to pass to gcov
gcov_executableNogcovgcov executable to run. Defaults to 'gcov'
gcov_ignoreNononePaths to ignore during gcov gathering
gcov_includeNononePaths to include during gcov gathering
handle_no_reports_foundNofalseIf no coverage reports are found, do not raise an exception.
job_codeNononeNo description in action.yml.
nameNononeCustom defined name of the upload. Visible in the Codecov UI
network_filterNononeSpecify a filter on the files listed in the network section of the Codecov report. This will only add files whose path begin with the specified filter. Useful for upload-specific path fixing.
network_prefixNononeSpecify a prefix on files listed in the network section of the Codecov report. Useful to help resolve path fixing.
osNononeOverride the assumed OS. Options available at cli.codecov.io
override_branchNononeSpecify the branch to be displayed with this commit on Codecov
override_buildNononeSpecify the build number manually
override_build_urlNononeThe URL of the build where this is running
override_commitNononeCommit SHA (with 40 chars)
override_prNononeSpecify the pull request number manually. Used to override pre-existing CI environment variables.
pluginsNononeComma-separated list of plugins to run. Specify `noop` to turn off all plugins
recurse_submodulesNofalseWhether to enumerate files inside of submodules for path-fixing purposes. Off by default.
report_codeNononeThe code of the report if using local upload. If unsure, leave default. Read more here https://docs.codecov.com/docs/the-codecov-cli#how-to-use-local-upload
report_typeNononeThe type of file to upload, coverage by default. Possible values are "test_results", "coverage".
root_dirNononeRoot folder from which to consider paths on the network section. Defaults to current working directory.
run_commandNoupload-coverageChoose which CLI command to run. Options are "upload-coverage", "empty-upload", "pr-base-picking", "send-notifications". "upload-coverage" is run by default.
skip_validationNofalseSkip integrity checking of the CLI. This is NOT recommended.
slugNonone[Required when using the org token] Set to the owner/repo slug used instead of the private repo token. Only applicable to some Enterprise users.
swift_projectNononeSpecify the swift project name. Useful for optimization.
tokenNononeRepository Codecov token. Used to authorize report uploads
urlNononeSet to the Codecov instance URl. Used by Dedicated Enterprise Cloud customers.
use_legacy_upload_endpointNofalseUse the legacy upload endpoint.
use_oidcNofalseUse OIDC instead of token. This will ignore any token supplied
use_pypiNofalseUse the pypi version of the CLI instead of from cli.codecov.io
verboseNofalseEnable verbose logging
versionNolatestWhich version of the Codecov CLI to use (defaults to 'latest')
working-directoryNononeDirectory in which to execute codecov.sh

Outputs

This action declares no outputs in its action.yml.

Examples

Upload a coverage report

Send coverage after your tests; the token is required for protected branches and forks.

name: Example
on:
  push:
    branches: [main]

permissions:
  contents: read

jobs:
  example:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - name: Codecov
        uses: codecov/codecov-action@v7
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: ./coverage.xml
          fail_ci_if_error: true

Each example passed actionlint (syntax, expressions and the inputs it knows for this action). They were not run in a live repository, so replace placeholder values such as names, ARNs and paths with your own.

Something out of date or wrong? Report it on our Contact page. This page is rebuilt from the action's repository roughly once a week.