Skip to content
Latchkey

How to Upload a Coverage Report as an Artifact in GitHub Actions

Upload the coverage output directory so reviewers can download and open the full HTML report.

After generating coverage, point actions/upload-artifact at the report directory (often coverage/) so the full HTML report is downloadable from the run.

Steps

  • Generate coverage with an HTML reporter.
  • Upload the coverage/ directory as an artifact.
  • Set a short retention since coverage reports churn.

Workflow

.github/workflows/ci.yml
jobs:
  coverage:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci && npm test -- --coverage --coverageReporters=html lcov
      - uses: actions/upload-artifact@v4
        with:
          name: coverage-report
          path: coverage/
          retention-days: 7

Gotchas

  • Artifacts are zipped on upload, so the HTML is browsable only after you unzip it.
  • Limit path: to the report folder so you do not upload the whole workspace.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →