{"id":42618528,"url":"https://github.com/getsentry/codecov-action","last_synced_at":"2026-04-04T22:01:47.611Z","repository":{"id":327222836,"uuid":"1107895813","full_name":"getsentry/codecov-action","owner":"getsentry","description":"GitHub Action for code coverage and test result reporting using GitHub Artifacts.","archived":false,"fork":false,"pushed_at":"2026-03-30T18:20:06.000Z","size":2424,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-03T02:45:28.517Z","etag":null,"topics":["code-coverage","codecov","coverage-report","tag-production","test-reporting"],"latest_commit_sha":null,"homepage":"https://getsentry.github.io/codecov-action/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/getsentry.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"custom":["https://sentry.io/pricing/","https://sentry.io/"]}},"created_at":"2025-12-01T18:47:44.000Z","updated_at":"2026-03-30T18:16:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/getsentry/codecov-action","commit_stats":null,"previous_names":["mathuraditya724/codecov-action","getsentry/codecov-action"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/getsentry/codecov-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getsentry%2Fcodecov-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getsentry%2Fcodecov-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getsentry%2Fcodecov-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getsentry%2Fcodecov-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getsentry","download_url":"https://codeload.github.com/getsentry/codecov-action/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getsentry%2Fcodecov-action/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31416324,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T20:09:54.854Z","status":"ssl_error","status_checked_at":"2026-04-04T20:09:44.350Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-coverage","codecov","coverage-report","tag-production","test-reporting"],"created_at":"2026-01-29T04:11:24.756Z","updated_at":"2026-04-04T22:01:47.565Z","avatar_url":"https://github.com/getsentry.png","language":"TypeScript","readme":"# Codecov Action\n\n![build](https://github.com/getsentry/codecov-action/actions/workflows/build.yml/badge.svg)\n\nSelf-hosted coverage and test reporting with GitHub Actions. Uses GitHub Artifacts for storage — no external service or Codecov token required.\n\n## Quick Start\n\n```yaml\nname: Test\n\non:\n  push:\n    branches: [main]\n  pull_request:\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      \n      - name: Run tests with coverage\n        run: npm test -- --coverage\n      \n      - name: Codecov Action\n        uses: getsentry/codecov-action@v1\n        with:\n          token: ${{ secrets.GITHUB_TOKEN }}\n```\n\n## Supported Coverage Formats\n\n| Format | File Patterns | Languages/Tools |\n|--------|--------------|-----------------|\n| **Clover XML** | `clover.xml` | Istanbul/NYC (JS/TS), PHPUnit, OpenClover |\n| **Cobertura XML** | `coverage.xml`, `cobertura.xml` | coverage.py (Python), Coverlet (.NET), PHPUnit |\n| **JaCoCo XML** | `jacoco.xml` | Java, Kotlin, Scala |\n| **LCOV** | `lcov.info`, `*.lcov` | c8, lcov (C/C++), grcov (Rust), gcov |\n| **Istanbul JSON** | `coverage-final.json` | Jest, Vitest, NYC (JS/TS) |\n| **Go Coverage** | `coverage.out`, `cover.out` | `go test -coverprofile` |\n| **Codecov JSON** | `codecov.json` | cargo-llvm-cov (Rust), custom tools |\n\n## Inputs\n\n### Core Inputs\n\n| Input | Description | Required | Default |\n|-------|-------------|----------|---------|\n| `token` | GitHub token for API access and artifacts | **Yes** | — |\n| `base-branch` | Base branch to compare results against | No | Auto-detected |\n| `enable-tests` | Enable test results reporting | No | `true` |\n| `enable-coverage` | Enable coverage reporting | No | `true` |\n| `post-pr-comment` | Post results as a PR comment | No | `false` |\n\n### Coverage File Discovery (Codecov-style)\n\n| Input | Description | Required | Default |\n|-------|-------------|----------|---------|\n| `files` | Comma-separated list of coverage files | No | — |\n| `directory` | Folder to search for coverage files | No | `.` |\n| `exclude` | Comma-separated patterns to exclude | No | — |\n| `coverage-format` | Format hint: `auto`, `clover`, `cobertura`, `jacoco`, `lcov`, `istanbul`, `go`, `codecov` | No | `auto` |\n| `disable-search` | Disable auto-search, use only explicit `files` | No | `false` |\n\n### Behavior Flags (Codecov-style)\n\n| Input | Description | Required | Default |\n|-------|-------------|----------|---------|\n| `fail-ci-if-error` | Fail if coverage processing errors (e.g., parsing failures, missing files) | No | `false` |\n| `handle-no-reports-found` | Don't fail if no coverage found | No | `false` |\n| `verbose` | Enable verbose logging | No | `false` |\n\n### Status Checks \u0026 Thresholds\n\n| Input | Description | Required | Default |\n|-------|-------------|----------|---------|\n| `target-project` | Target project coverage % (or `auto` to use base branch coverage) | No | — |\n| `threshold-project` | Allowed project coverage drop % (only used when target is `auto`) | No | — |\n| `target-patch` | Target patch coverage % for changed lines | No | `80` |\n| `fail-on-error` | Fail CI if coverage thresholds are not met (distinct from `fail-ci-if-error`) | No | `false` |\n\nWhen thresholds are not configured, status checks report coverage metrics without enforcing pass/fail.\n\n### Grouping \u0026 Identification\n\n| Input | Description | Required | Default |\n|-------|-------------|----------|---------|\n| `flags` | Comma-separated flags to tag coverage (e.g., `unittests,frontend`) | No | — |\n| `name` | Custom name for this coverage upload. Also used to differentiate artifacts in matrix builds | No | — |\n\n### Test Results\n\n| Input | Description | Required | Default |\n|-------|-------------|----------|---------|\n| `junit-xml-pattern` | Glob pattern for JUnit XML files | No | `./**/*.junit.xml` |\n\n## Outputs\n\n### Test Outputs\n\n| Output | Description |\n|--------|-------------|\n| `total-tests` | Total number of tests run |\n| `passed-tests` | Number of passed tests |\n| `failed-tests` | Number of failed tests |\n| `test-pass-rate` | Percentage of tests that passed |\n| `tests-added` | Tests added compared to base branch |\n| `tests-removed` | Tests removed compared to base branch |\n| `tests-fixed` | Tests changed from failing to passing |\n| `tests-broken` | Tests changed from passing to failing |\n\n### Coverage Outputs\n\n| Output | Description |\n|--------|-------------|\n| `line-coverage` | Line coverage percentage |\n| `branch-coverage` | Branch coverage percentage |\n| `coverage-change` | Change in line coverage vs base branch |\n| `branch-coverage-change` | Change in branch coverage vs base branch |\n| `coverage-improved` | Whether coverage improved (`true`/`false`) |\n| `coverage-format` | The detected/used coverage format |\n\n## Usage Examples\n\n### Basic Usage (Auto-detect)\n\n```yaml\n- name: Codecov Action\n  uses: getsentry/codecov-action@v1\n  with:\n    token: ${{ secrets.GITHUB_TOKEN }}\n```\n\n### Explicit Files (Codecov-style)\n\n```yaml\n- name: Codecov Action\n  uses: getsentry/codecov-action@v1\n  with:\n    token: ${{ secrets.GITHUB_TOKEN }}\n    files: ./coverage/lcov.info,./backend/coverage.xml\n    disable-search: true\n    flags: unittests\n    name: my-coverage\n    verbose: true\n```\n\n### Python with Cobertura\n\n```yaml\n- name: Run tests\n  run: pytest --cov=src --cov-report=xml\n\n- name: Codecov Action\n  uses: getsentry/codecov-action@v1\n  with:\n    token: ${{ secrets.GITHUB_TOKEN }}\n    directory: ./\n    coverage-format: cobertura\n    fail-ci-if-error: true\n```\n\n### Java with JaCoCo\n\n```yaml\n- name: Build and test\n  run: ./gradlew test jacocoTestReport\n\n- name: Codecov Action\n  uses: getsentry/codecov-action@v1\n  with:\n    token: ${{ secrets.GITHUB_TOKEN }}\n    files: ./build/reports/jacoco/test/jacocoTestReport.xml\n    coverage-format: jacoco\n```\n\n### Go Coverage\n\n```yaml\n- name: Run tests\n  run: go test -coverprofile=coverage.out ./...\n\n- name: Codecov Action\n  uses: getsentry/codecov-action@v1\n  with:\n    token: ${{ secrets.GITHUB_TOKEN }}\n    files: ./coverage.out\n    coverage-format: go\n```\n\n### Rust with cargo-llvm-cov\n\n```yaml\n- name: Install cargo-llvm-cov\n  uses: taiki-e/install-action@cargo-llvm-cov\n\n- name: Run tests with coverage\n  run: cargo llvm-cov --codecov --output-path codecov.json\n\n- name: Codecov Action\n  uses: getsentry/codecov-action@v1\n  with:\n    token: ${{ secrets.GITHUB_TOKEN }}\n    files: ./codecov.json\n    coverage-format: codecov\n```\n\n### JavaScript/TypeScript with LCOV\n\n```yaml\n- name: Run tests\n  run: npm test -- --coverage --coverageReporters=lcov\n\n- name: Codecov Action\n  uses: getsentry/codecov-action@v1\n  with:\n    token: ${{ secrets.GITHUB_TOKEN }}\n    directory: ./coverage\n    coverage-format: lcov\n```\n\n### Monorepo with Flags\n\n```yaml\n- name: Frontend Coverage\n  uses: getsentry/codecov-action@v1\n  with:\n    token: ${{ secrets.GITHUB_TOKEN }}\n    directory: ./frontend/coverage\n    flags: frontend\n    name: frontend-coverage\n\n- name: Backend Coverage\n  uses: getsentry/codecov-action@v1\n  with:\n    token: ${{ secrets.GITHUB_TOKEN }}\n    directory: ./backend/coverage\n    flags: backend\n    name: backend-coverage\n```\n\n### Matrix Builds\n\nWhen running coverage in a matrix strategy (e.g., multiple Python versions), use the `name` input to give each matrix entry a unique artifact name and avoid upload conflicts:\n\n```yaml\njobs:\n  test:\n    runs-on: ubuntu-latest\n    strategy:\n      matrix:\n        python-version: [\"3.10\", \"3.11\", \"3.12\", \"3.13\"]\n    steps:\n      - uses: actions/checkout@v4\n\n      - uses: actions/setup-python@v5\n        with:\n          python-version: ${{ matrix.python-version }}\n\n      - name: Run tests\n        run: pytest --cov=src --cov-report=xml\n\n      - name: Codecov Action\n        uses: getsentry/codecov-action@v1\n        with:\n          token: ${{ secrets.GITHUB_TOKEN }}\n          files: coverage.xml\n          name: py${{ matrix.python-version }}\n```\n\n### Coverage Thresholds with Status Checks\n\nUse built-in threshold enforcement with GitHub status checks:\n\n```yaml\n- name: Codecov Action\n  uses: getsentry/codecov-action@v1\n  with:\n    token: ${{ secrets.GITHUB_TOKEN }}\n    target-project: auto          # Use base branch coverage as target\n    threshold-project: 1          # Allow up to 1% coverage drop\n    target-patch: 80              # Require 80% coverage on changed lines\n    fail-on-error: true           # Fail CI if thresholds not met\n```\n\nThis creates two status checks (`codecov/project` and `codecov/patch`) that:\n- Appear on commits and PRs\n- Can be required via branch protection rules\n- Provide clear pass/fail feedback\n\n## How It Works\n\n### 1. File Discovery\n\nThe action searches for coverage files using:\n- **Explicit files**: If `files` input is provided\n- **Auto-discovery**: Searches `directory` for known coverage file patterns\n- **Format detection**: Auto-detects format from file content\n\n### 2. Parsing \u0026 Aggregation\n\nMultiple coverage files are parsed and aggregated:\n- Supports mixing formats (e.g., frontend LCOV + backend Cobertura)\n- Calculates unified line, branch, and method coverage\n\n### 3. Artifact Storage\n\nResults are stored as GitHub Artifacts:\n- `codecov-coverage-results-{branch}[-{name}][-{flags}]` — Aggregated coverage data\n- `codecov-test-results-{branch}` — Aggregated test results\n\nWhen using the `name` input, it is appended to the artifact name to avoid conflicts in matrix builds.\n\n### 4. Base Branch Comparison\n\nOn PRs or feature branches:\n1. Auto-detects the repository's default branch (or uses the explicit `base-branch` input)\n2. Downloads latest results from base branch\n3. Compares current vs baseline\n4. Calculates deltas\n\n### 5. Reporting\n\n- **Job Summary**: Always generated in Actions UI\n- **PR Comment**: Optional detailed comment on PRs\n\n### 6. Status Checks\n\nThe action creates GitHub commit status checks that appear on commits and PRs:\n\n| Status Context | Description |\n|----------------|-------------|\n| `codecov/project` | Overall project coverage status (pass/fail based on target) |\n| `codecov/patch` | Coverage for changed lines in the PR |\n\nThese status checks:\n- Show as green checkmarks or red X marks on commits and PRs\n- Can be used in **branch protection rules** to require coverage thresholds\n- Provide immediate feedback on coverage quality\n\n## Status Badges\n\nDisplay your CI status in your README using GitHub's workflow badge:\n\n```markdown\n![CI](https://github.com/{owner}/{repo}/actions/workflows/{workflow}.yml/badge.svg)\n```\n\n## Test Results\n\n### Supported Format\n\n| Format | Typical File | Common Test Frameworks |\n|--------|--------------|----------------------|\n| JUnit XML | `*.junit.xml` | Jest, Vitest, Mocha, pytest, JUnit, NUnit, PHPUnit |\n\n### Configuration Examples\n\n**Jest / Vitest:**\n```json\n{\n  \"reporters\": [\"default\", [\"jest-junit\", { \"outputFile\": \"report.junit.xml\" }]]\n}\n```\n\n**pytest:**\n```bash\npytest --junitxml=report.junit.xml\n```\n\n## Coverage Configuration Examples\n\n### JavaScript/TypeScript (Jest/Vitest)\n\n```json\n{\n  \"coverageReporters\": [\"lcov\", \"clover\", \"json\"]\n}\n```\n\n### Python (pytest-cov)\n\n```bash\npytest --cov=src --cov-report=xml  # Cobertura format\n```\n\n### Java (Gradle + JaCoCo)\n\n```groovy\njacocoTestReport {\n    reports {\n        xml.required = true\n    }\n}\n```\n\n### Go\n\n```bash\ngo test -coverprofile=coverage.out ./...\n```\n\n### Rust (cargo-llvm-cov)\n\n```bash\n# Install cargo-llvm-cov\ncargo install cargo-llvm-cov\n\n# Generate Codecov JSON format\ncargo llvm-cov --codecov --output-path codecov.json\n\n# Or generate LCOV format\ncargo llvm-cov --lcov --output-path lcov.info\n```\n\n### .NET (Coverlet)\n\n```bash\ndotnet test --collect:\"XPlat Code Coverage\"\n# or\ndotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura\n```\n\n## Configuration File\n\nYou can configure status check thresholds using a `.github/coverage.yml` file in your repository. Action inputs take precedence over the config file, allowing you to override settings per-workflow.\n\n```yaml\n# .github/coverage.yml\ncoverage:\n  status:\n    project:\n      target: 80        # Target coverage percentage (or \"auto\" to use base branch)\n      threshold: 1      # Allowed coverage drop when using \"auto\" (supports \"1%\" or 1)\n      informational: false  # When true, status check reports but never fails the build\n    patch:\n      target: 90        # Target coverage for changed lines\n      informational: false\n  ignore:\n    - \"**/*.test.ts\"    # Patterns to exclude from coverage\n    - \"**/fixtures/**\"\n\n# Enable PR comments from config (alternative to post-pr-comment input)\ncomment: true\n\n# Report display settings\nconfig:\n  files: changed   # all (default) | changed | none\n```\n\n| Option | Description |\n|--------|-------------|\n| `status.project.target` | Target project coverage % (number or `\"auto\"`) |\n| `status.project.threshold` | Allowed drop from base branch when target is `\"auto\"`. Supports number (`1`) or string (`\"1%\"`) |\n| `status.project.informational` | When `true`, status check reports but never fails the build (advisory mode) |\n| `status.patch.target` | Target coverage % for changed lines |\n| `status.patch.informational` | When `true`, patch status check is advisory-only |\n| `ignore` | Glob patterns to exclude from coverage calculations |\n| `comment` | Enable PR comments. Set to `true` or `false` |\n| `config.files` | Control file table scope in reports (Job Summary + PR comments). Values: `all` (default), `changed`, `none` |\n\n### Codecov YAML Compatibility\n\nThis action also supports the standard Codecov YAML format with nested `default` keys:\n\n```yaml\n# .github/codecov.yml (Codecov-compatible format)\ncoverage:\n  status:\n    project:\n      default:\n        target: auto\n        threshold: 10%    # Percentage strings are supported\n        informational: true\n    patch:\n      default:\n        target: 80\n  ignore:\n    - \"tests/**\"\n\ncomment: true\n\nconfig:\n  files: changed\n```\n\nBoth formats work identically—use whichever style you prefer.\n\n### Report File List Mode\n\nUse `config.files` to control the \"Files with missing lines\" section in both Job Summary and PR comments:\n\n- `all` (default): show all files with missing/partial lines\n- `changed`: show only non-deleted files from the PR diff\n- `none`: hide the section entirely\n\n## Permissions\n\n```yaml\npermissions:\n  contents: read        # Read repository contents\n  actions: read         # Read workflow runs and artifacts\n  pull-requests: write  # Post PR comments (if enabled)\n  statuses: write       # Create commit status checks\n```\n\n\u003e **Note**: On pull requests from forks, `GITHUB_TOKEN` has restricted permissions regardless of the workflow's `permissions` block. PR comments and commit status checks will be skipped gracefully with a warning in this case. Coverage results and Job Summary are still generated.\n\n## Migration from Codecov\n\nIf you're migrating from the official Codecov action:\n\n| Codecov Input | This Action |\n|---------------|-------------|\n| `fail_ci_if_error` | `fail-ci-if-error` |\n| `files` | `files` |\n| `directory` | `directory` |\n| `exclude` | `exclude` |\n| `flags` | `flags` |\n| `name` | `name` |\n| `verbose` | `verbose` |\n| `handle-no-reports-found` | `handle-no-reports-found` |\n\n**Note**: This action doesn't require a Codecov token—it uses GitHub's native artifacts for storage.\n","funding_links":["https://sentry.io/pricing/","https://sentry.io/"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetsentry%2Fcodecov-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetsentry%2Fcodecov-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetsentry%2Fcodecov-action/lists"}