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 GitHub

Trust Signals

Scorecard Score
not yet scored
Maintenance Recency
Activelast commit Jun 23, 2026
License
MIT

Pinned Snippet

workflow.ymlSHA-pinned
uses: affanmir/diff-cover-action@a35ea05c1c458490473f6fc2233737e809678273 # v2.1.1

tags can be moved; commit SHAs can't. why a SHA?

namedescriptionrequireddefault
modeRun mode: "coverage" for diff-cover or "quality" for diff-qualitynocoverage
coverage-filesSpace-separated coverage report paths (XML or lcov). Supports glob patterns. Required when mode=coverage.no""
violationsCode 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-reportsSpace-separated pre-generated violation report files for diff-quality.no""
quality-optionsPass-through arguments to the violations tool.no""
compare-branchBranch to compare against for the diff.noorigin/main
diff-range-notationGit diff range notation: "..." (default) or ".."no...
diff-filePath to a pre-generated diff file. Overrides git branch comparison.no""
ignore-stagedExclude staged changes from the diff.nofalse
ignore-unstagedExclude unstaged changes from the diff.nofalse
include-untrackedInclude untracked files in the diff.nofalse
ignore-whitespaceIgnore whitespace changes in the diff.nofalse
excludeNewline-separated fnmatch patterns to exclude files.no""
includeNewline-separated glob patterns to include files.no""
src-rootsSpace-separated source root directories (needed for JaCoCo reports).no""
expand-coverage-reportAdd unreported lines with same hit count as previous line (XML only).nofalse
show-uncoveredDisplay uncovered lines in console output.nofalse
quietSuppress info/warning messages, show only errors.nofalse
config-filePath to a TOML configuration file for diff-cover.no""
fail-underMinimum acceptable coverage/quality percentage (0-100). Default 0 means no threshold.no0
fail-on-thresholdIf true, fail the step when coverage is below fail-under. If false, only report.notrue
titleOptional heading displayed at the top of the PR comment (e.g. app name in a monorepo).no""
github-tokenGitHub token for PR comments and check annotations. Defaults to the built-in GITHUB_TOKEN.no""
post-commentPost or update a PR comment with results.notrue
comment-identifierUnique string to identify and update existing comments instead of creating new ones.nodiff-cover-action
create-annotationsCreate inline annotations on uncovered or violating lines.notrue
annotation-typeAnnotation severity: "warning", "error", or "notice".nowarning
annotation-limitMaximum number of annotations to create. GitHub caps at 50 per job.no50
create-badgeGenerate a shields.io endpoint JSON file for badge display.nofalse
badge-filenameOutput filename for the shields.io badge JSON.nodiff-cover-badge.json
namedescription
total-percentOverall coverage or quality percentage (integer).
total-percent-floatOverall percentage with two decimal places.
total-linesTotal number of lines in the diff.
total-violationsNumber of uncovered or violating lines.
files-changedNumber of files with changes in the diff.
threshold-met"true" if coverage meets fail-under threshold, "false" otherwise.
comment-idID of the created or updated PR comment. Empty if no comment was posted.
report-jsonPath to the generated JSON report file.
badge-jsonPath to the generated badge JSON file. Empty if not generated.
exit-codeRaw exit code from the diff-cover CLI.