Reference

GitHub Action

The inputs and outputs of kucherenko/jscpd@v5, generated from the action.yml of jscpd 5.4.0.

kucherenko/jscpd@v5 runs the same binary as the command line, so every input below is a CLI option with the same name. The CI guide shows the workflows; this page is the list.

.github/workflows/jscpd.yml
- uses: kucherenko/jscpd@v5
  with:
    threshold: 3

Inputs

InputWhat it doesDefault
pathPaths to scan for duplicates (space-separated).
configPath to .jscpd.json config file—
min-tokensMinimum number of tokens to consider a duplicate50
min-linesMinimum number of lines to consider a duplicate5
max-linesMaximum lines per block to consider—
modeDetection mode: mild, weak, or strictmild
formatComma-separated list of file extensions/formats to check—
ignoreComma-separated glob patterns to ignore—
ignore-patternComma-separated regex patterns to skip matching tokens—
reportersComma-separated list of reporters (console, json, xml, csv, html, markdown, badge, sarif, ai, xcode, console-full, threshold, silent)console
outputOutput directory for file reportersreport
thresholdMaximum duplication percentage before exit 1—
baselinePath to a clone baseline file (e.g. .jscpd-baseline.json): clones absent from it are reported as new—
update-baselineRewrite the baseline file from the current run (requires baseline)false
fail-on-new-clonesExit 1 when new clones are found (requires baseline or baseline-from-ref). Use 'true' for zero tolerance, or an integer N to allow up to N new clones—
fail-on-emptyExit 1 when the scan analyzes no files: the paths exist but nothing matched the format, ignore or pattern filtersfalse
baseline-from-refCompare against an ephemeral baseline built from a git ref's tree (e.g. origin/main); needs the ref fetched (fetch-depth: 0). Conflicts with baseline—
historyDuplication trend over git history: scan every commit in this range (e.g. v5.0.0..HEAD) and print a chart and table in the log; needs the range fetched (fetch-depth: 0)—
blameEnrich clones with git blame datafalse
exit-codeExit with code when duplicates found. Use 'true' for default code 1, or an integer like '2' for a custom code—
patternGlob pattern to find files to scan—
max-size"Skip files larger than SI—

Outputs

OutputWhat it holds
duplication-percentagePercentage of duplicated code found
clones-foundNumber of clone pairs found
duplicated-linesNumber of duplicated lines
total-linesTotal number of lines scanned
files-countNumber of source files scanned
report-pathPath to the output directory
sarif-pathPath to the SARIF report file (empty if not generated)
exit-codeExit code from jscpd (non-zero if threshold exceeded or --exit-code used)

Read an output in a later step as ${{ steps.<id>.outputs.<name> }} after giving the jscpd step an id.