🛡 Diff Cover Action

Report test coverage and code quality only on changed lines in your GitHub pull requests. Zero vendor lock-in.

GitHub Marketplace GitHub Stars Latest Release MIT License
View on Marketplace View on GitHub

Features

Diff Coverage

Find lines in your PR that aren't covered by tests. Supports Cobertura XML, lcov, JaCoCo, and Clover reports.

Diff Quality

Find lint and style violations only in changed code. Supports 13+ tools across Python, JavaScript, C++, and shell.

PR Comments

Auto-posted, idempotent comments that update on re-run instead of spamming your pull request.

Inline Annotations

Uncovered lines and violations appear directly in the PR diff view as warnings, errors, or notices.

Step Summaries

Coverage and quality tables appear in the GitHub Actions run UI — visible without opening the PR.

Zero Vendor Lock-in

Everything runs locally in the GitHub Actions runner. No external services, no accounts, no data leaving your CI.

Quick Start

# .github/workflows/coverage.yml
name: Coverage
on: [pull_request]

permissions:
  contents: read
  pull-requests: write

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Run tests with coverage
        run: |
          pip install pytest pytest-cov
          pytest --cov --cov-report=xml

      - name: Diff Coverage
        uses: Affanmir/diff-cover-action@v1
        with:
          coverage-files: coverage.xml
          fail-under: '80'

Supported Tools

Works with any language that produces standard coverage reports.

CategoryTools
Coverage formatsCobertura XML, lcov, JaCoCo XML, Clover XML
Python lintersruff, flake8, pylint, pycodestyle, pyflakes, mypy, pydocstyle
JavaScript linterseslint, jshint
Othercheckstyle, checkstylexml, clang, cppcheck, shellcheck
Python JavaScript TypeScript Java Go Rust C# Ruby PHP Kotlin Swift C++