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: 7Gotchas
- 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
How to Upload Test Results as an Artifact in GitHub ActionsSave JUnit XML or other test output as a downloadable GitHub Actions artifact with actions/upload-artifact, k…
How to Generate and Upload an HTML Report in GitHub ActionsBuild an HTML report during a GitHub Actions run and attach it as a downloadable artifact, or publish it to G…