@@ -16,13 +16,17 @@ and propagate the real gate result.
1616The v2 action flow is:
1717
18181 . set up Python
19- 2 . install ` codeclone ` from PyPI
19+ 2 . install ` codeclone `
20203 . optionally require a committed baseline
21214 . run CodeClone with JSON + optional SARIF output
22225 . optionally upload SARIF to GitHub Code Scanning
23236 . optionally post or update a PR summary comment
24247 . return the real CodeClone exit code as the job result
2525
26+ When the action is used from the checked-out CodeClone repository itself
27+ (` uses: ./.github/actions/codeclone ` ), it installs CodeClone from the repo
28+ source under test. Remote consumers still install from PyPI.
29+
2630## Basic usage
2731
2832``` yaml
@@ -41,8 +45,8 @@ name: CodeClone
4145
4246on:
4347 pull_request:
44- types: [opened, synchronize, reopened]
45- paths: ["**/*.py"]
48+ types: [ opened, synchronize, reopened ]
49+ paths: [ "**/*.py" ]
4650
4751permissions:
4852 contents: read
@@ -67,39 +71,39 @@ jobs:
6771
6872# # Inputs
6973
70- | Input | Default | Purpose |
71- |-------|---------| ---------|
72- | `python-version` | `3.13` | Python version used to run the action |
73- | `package-version` | `""` | CodeClone version from PyPI; empty means latest stable |
74- | `path` | `.` | Project root to analyze |
75- | `json-path` | `.cache/codeclone/report.json` | JSON report output path |
76- | `sarif` | `true` | Generate SARIF and try to upload it |
77- | `sarif-path` | `.cache/codeclone/report.sarif` | SARIF output path |
78- | `pr-comment` | `true` | Post or update a PR summary comment |
79- | `fail-on-new` | `true` | Fail if new clone groups are detected |
80- | `fail-on-new-metrics` | `false` | Fail if metrics regress vs baseline |
81- | `fail-threshold` | `-1` | Max allowed function+block clone groups |
82- | `fail-complexity` | `-1` | Max cyclomatic complexity |
83- | `fail-coupling` | `-1` | Max coupling CBO |
84- | `fail-cohesion` | `-1` | Max cohesion LCOM4 |
85- | `fail-cycles` | `false` | Fail on dependency cycles |
86- | `fail-dead-code` | `false` | Fail on high-confidence dead code |
87- | `fail-health` | `-1` | Minimum health score |
88- | `require-baseline` | `true` | Fail early if the baseline file is missing |
89- | `baseline-path` | `codeclone.baseline.json` | Baseline path passed to CodeClone |
90- | `metrics-baseline-path` | `codeclone.baseline.json` | Metrics baseline path passed to CodeClone |
91- | `extra-args` | `""` | Additional CodeClone CLI arguments |
92- | `no-progress` | `true` | Disable progress output |
74+ | Input | Default | Purpose |
75+ |------------------------- |---------------------------------|---------------------------------------------------------------------------------------------------------- ---------|
76+ | `python-version` | `3.13` | Python version used to run the action |
77+ | `package-version` | `""` | CodeClone version from PyPI for remote installs; ignored when the action runs from the checked-out CodeClone repo |
78+ | `path` | `.` | Project root to analyze |
79+ | `json-path` | `.cache/codeclone/report.json` | JSON report output path |
80+ | `sarif` | `true` | Generate SARIF and try to upload it |
81+ | `sarif-path` | `.cache/codeclone/report.sarif` | SARIF output path |
82+ | `pr-comment` | `true` | Post or update a PR summary comment |
83+ | `fail-on-new` | `true` | Fail if new clone groups are detected |
84+ | `fail-on-new-metrics` | `false` | Fail if metrics regress vs baseline |
85+ | `fail-threshold` | `-1` | Max allowed function+block clone groups |
86+ | `fail-complexity` | `-1` | Max cyclomatic complexity |
87+ | `fail-coupling` | `-1` | Max coupling CBO |
88+ | `fail-cohesion` | `-1` | Max cohesion LCOM4 |
89+ | `fail-cycles` | `false` | Fail on dependency cycles |
90+ | `fail-dead-code` | `false` | Fail on high-confidence dead code |
91+ | `fail-health` | `-1` | Minimum health score |
92+ | `require-baseline` | `true` | Fail early if the baseline file is missing |
93+ | `baseline-path` | `codeclone.baseline.json` | Baseline path passed to CodeClone |
94+ | `metrics-baseline-path` | `codeclone.baseline.json` | Metrics baseline path passed to CodeClone |
95+ | `extra-args` | `""` | Additional CodeClone CLI arguments |
96+ | `no-progress` | `true` | Disable progress output |
9397
9498For numeric gate inputs, `-1` means "disabled".
9599
96100# # Outputs
97101
98- | Output | Meaning |
99- |--------| ---------|
100- | `exit-code` | CodeClone process exit code |
101- | `json-path` | Resolved JSON report path |
102- | `sarif-path` | Resolved SARIF report path |
102+ | Output | Meaning |
103+ |-----------------|--------------------------------------------------- ---------|
104+ | `exit-code` | CodeClone process exit code |
105+ | `json-path` | Resolved JSON report path |
106+ | `sarif-path` | Resolved SARIF report path |
103107| `pr-comment-id` | PR comment id when the action updated or created a comment |
104108
105109# # Exit behavior
@@ -148,6 +152,12 @@ with:
148152 package-version: "2.0.0b3"
149153` ` `
150154
155+ Local/self-repo validation :
156+
157+ - `uses : ./.github/actions/codeclone` installs CodeClone from the checked-out
158+ repository source, so beta branches and unreleased commits do not depend on
159+ PyPI publication.
160+
151161# # Notes and limitations
152162
153163- For private repositories without GitHub Advanced Security, SARIF upload may
0 commit comments