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
| Input | What it does | Default |
|---|---|---|
path | Paths to scan for duplicates (space-separated) | . |
config | Path to .jscpd.json config file | — |
min-tokens | Minimum number of tokens to consider a duplicate | 50 |
min-lines | Minimum number of lines to consider a duplicate | 5 |
max-lines | Maximum lines per block to consider | — |
mode | Detection mode: mild, weak, or strict | mild |
format | Comma-separated list of file extensions/formats to check | — |
ignore | Comma-separated glob patterns to ignore | — |
ignore-pattern | Comma-separated regex patterns to skip matching tokens | — |
reporters | Comma-separated list of reporters (console, json, xml, csv, html, markdown, badge, sarif, ai, xcode, console-full, threshold, silent) | console |
output | Output directory for file reporters | report |
threshold | Maximum duplication percentage before exit 1 | — |
baseline | Path to a clone baseline file (e.g. .jscpd-baseline.json): clones absent from it are reported as new | — |
update-baseline | Rewrite the baseline file from the current run (requires baseline) | false |
fail-on-new-clones | Exit 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-empty | Exit 1 when the scan analyzes no files: the paths exist but nothing matched the format, ignore or pattern filters | false |
baseline-from-ref | Compare 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 | — |
history | Duplication 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) | — |
blame | Enrich clones with git blame data | false |
exit-code | Exit with code when duplicates found. Use 'true' for default code 1, or an integer like '2' for a custom code | — |
pattern | Glob pattern to find files to scan | — |
max-size | "Skip files larger than SI | — |
Outputs
| Output | What it holds |
|---|---|
duplication-percentage | Percentage of duplicated code found |
clones-found | Number of clone pairs found |
duplicated-lines | Number of duplicated lines |
total-lines | Total number of lines scanned |
files-count | Number of source files scanned |
report-path | Path to the output directory |
sarif-path | Path to the SARIF report file (empty if not generated) |
exit-code | Exit 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.