9to5 coverage · Integrations

Code coverage in GitHub Actions

Connect existing CI coverage reports to GitHub PR checks and read-only context for coding agents.

Start with a report your tests already produce

Install the GitHub App for the repository, sign in, and store its repository or organization upload token as COVERAGE_UPLOAD_TOKEN in Actions secrets. Choose the smallest useful token scope. Your workflow must run tests and generate LCOV, Cobertura XML or JaCoCo XML before uploading.

Jest and Vitest · pytest · Maven and Gradle · Elixir

Add the upload step after tests

- name: Upload coverage
  uses: 9to5/9to5-coverage-action@v1
  with:
    token: ${{ secrets.COVERAGE_UPLOAD_TOKEN }}
    path: coverage/lcov.info

Replace the path with the report your runner actually generated. The action uses the production endpoint by default. Keep test execution and the report in the same checkout, and do not upload a stale report left by a previous build.

Run on the base branch and on pull requests

A PR report supplies the changed-line result; a base report enables the project comparison. Include both default-branch pushes and pull requests in the workflow. 9to5 prefers a matching-format base-SHA report and can fall back to a base-branch report. Inspect the baseline recorded for the run.

After uploading, inspect both project and patch checks on the tested commit. Add the exact check names to GitHub’s required checks only after the workflow has successfully produced them.

Handle the common gaps

  • A missing-file error usually means a reporter or upload path is wrong. Confirm the file exists before uploading.
  • Fork PR workflows normally do not receive repository secrets. Do not execute untrusted PR code with a privileged upload token.
  • Matrix jobs can produce different partial views. Do not assume reports are merged as they would be by another provider; generate the complete intended report before uploading.

Upload API reference · Upload troubleshooting