Reference
GitHub Action
41 views
The inputs and outputs of kucherenko/jscpd@v5, generated from the action.yml of jscpd 5.4.3.
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 |
report-name | Base name of the report files, without the extension (jscpd --report-name; default jscpd-report). The action reads | — |
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 and health trend over git history: 'true' for the last 30 commits of the branch (or the config's history range), or a range of commits to scan (e.g. v5.0.0..HEAD); 'false' leaves it off. Prints charts and a table in the log and needs the commits fetched (fetch-depth: 0, or 30 for 'true') | — |
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 SIZE (e.g. 100kb, 1mb) | — |
skip-local | Skip clones where both fragments are in the same directory | false |
ignore-case | Ignore case of symbols (experimental) | false |
ignore-identifiers | Treat identifiers as equal (Type-2 clones: renamed variables, functions, types): 'consistent' lets a name stand for one name on the other side only, 'blind' lets any name match any other, in similarity too, 'true' takes the matching from the config's ignoreIdentifiers, else consistent | false |
ignore-literals | Treat all string and numeric literals as equal | false |
ignore-annotations | Skip annotations and decorators (@Name, @Name(...)) | false |
max-gap-lines | Merge clones separated by at most N unmatched lines into one near-miss clone (Type-3); 0 disables | 0 |
similarity | Report pairs of functions whose normalized syntax trees share at least this ratio of their subtrees (a number in (0, 1], such as 0.8) as near-miss clones. JavaScript, TypeScript, Python, Java, Kotlin, Scala, C#, Go, Rust, C, C++, PHP, Ruby, Swift and Clojure; test files are left out. Not set: the config's value, else off | — |
min-nodes | The fewest nodes of a normalized syntax tree a function needs for similarity to compare it. Not set: the config's value, else 20 | — |
follow-symlinks | Follow symbolic links | false |
no-gitignore | Do not respect .gitignore files | false |
absolute | Use absolute paths in reports | false |
formats-exts | Custom format-to-extension mappings (e.g. javascript:es,es6;dart:dt) | — |
formats-names | Custom format-to-filename mappings (e.g. python:Tiltfile,BUCK;ruby:Buildfile) | — |
version | Version of jscpd to install. Empty (the default) installs the release this action ref belongs to, so pinning the action to a release tag or its SHA pins jscpd too; a commit between releases gets the release before it. 'latest' installs the newest release | — |
install-prefix | Installation directory for the jscpd binary on Linux/macOS (default: ~/.local/bin). Windows installs jscpd with npm and ignores it | — |
skip-install | Skip installation (use when jscpd/cpd is already installed) | false |
extra-args | Additional arguments passed directly to cpd/jscpd | — |
upload-report | Upload the report directory as a workflow artifact | false |
upload-sarif | Upload SARIF report to GitHub Code Scanning | true |
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.