affanmir/Diff Cover — PR Coverage & Quality Reports
Diff coverage and quality reports on pull requests. PR comments, annotations, badges. 13+ linters. No vendor lock-in.
View on GitHubTrust Signals
- Scorecard Score
- not yet scored
- Maintenance Recency
- Activelast commit Jun 23, 2026
- License
- MIT
Pinned Snippet
uses: affanmir/diff-cover-action@a35ea05c1c458490473f6fc2233737e809678273 # v2.1.1tags can be moved; commit SHAs can't. why a SHA?
Inputs
| name | description | required | default |
|---|---|---|---|
| mode | Run mode: "coverage" for diff-cover or "quality" for diff-quality | no | coverage |
| coverage-files | Space-separated coverage report paths (XML or lcov). Supports glob patterns. Required when mode=coverage. | no | "" |
| violations | Code quality tool name. Supported: pycodestyle, pyflakes, flake8, pylint, ruff.check, mypy, checkstyle, checkstylexml, clang, cppcheck, eslint, jshint, pydocstyle, shellcheck. Required when mode=quality. | no | "" |
| quality-input-reports | Space-separated pre-generated violation report files for diff-quality. | no | "" |
| quality-options | Pass-through arguments to the violations tool. | no | "" |
| compare-branch | Branch to compare against for the diff. | no | origin/main |
| diff-range-notation | Git diff range notation: "..." (default) or ".." | no | ... |
| diff-file | Path to a pre-generated diff file. Overrides git branch comparison. | no | "" |
| ignore-staged | Exclude staged changes from the diff. | no | false |
| ignore-unstaged | Exclude unstaged changes from the diff. | no | false |
| include-untracked | Include untracked files in the diff. | no | false |
| ignore-whitespace | Ignore whitespace changes in the diff. | no | false |
| exclude | Newline-separated fnmatch patterns to exclude files. | no | "" |
| include | Newline-separated glob patterns to include files. | no | "" |
| src-roots | Space-separated source root directories (needed for JaCoCo reports). | no | "" |
| expand-coverage-report | Add unreported lines with same hit count as previous line (XML only). | no | false |
| show-uncovered | Display uncovered lines in console output. | no | false |
| quiet | Suppress info/warning messages, show only errors. | no | false |
| config-file | Path to a TOML configuration file for diff-cover. | no | "" |
| fail-under | Minimum acceptable coverage/quality percentage (0-100). Default 0 means no threshold. | no | 0 |
| fail-on-threshold | If true, fail the step when coverage is below fail-under. If false, only report. | no | true |
| title | Optional heading displayed at the top of the PR comment (e.g. app name in a monorepo). | no | "" |
| github-token | GitHub token for PR comments and check annotations. Defaults to the built-in GITHUB_TOKEN. | no | "" |
| post-comment | Post or update a PR comment with results. | no | true |
| comment-identifier | Unique string to identify and update existing comments instead of creating new ones. | no | diff-cover-action |
| create-annotations | Create inline annotations on uncovered or violating lines. | no | true |
| annotation-type | Annotation severity: "warning", "error", or "notice". | no | warning |
| annotation-limit | Maximum number of annotations to create. GitHub caps at 50 per job. | no | 50 |
| create-badge | Generate a shields.io endpoint JSON file for badge display. | no | false |
| badge-filename | Output filename for the shields.io badge JSON. | no | diff-cover-badge.json |
Outputs
| name | description |
|---|---|
| total-percent | Overall coverage or quality percentage (integer). |
| total-percent-float | Overall percentage with two decimal places. |
| total-lines | Total number of lines in the diff. |
| total-violations | Number of uncovered or violating lines. |
| files-changed | Number of files with changes in the diff. |
| threshold-met | "true" if coverage meets fail-under threshold, "false" otherwise. |
| comment-id | ID of the created or updated PR comment. Empty if no comment was posted. |
| report-json | Path to the generated JSON report file. |
| badge-json | Path to the generated badge JSON file. Empty if not generated. |
| exit-code | Raw exit code from the diff-cover CLI. |