@getcodesentinel/codesentinel 1.9.1 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -67,11 +67,21 @@ CI example:
|
|
|
67
67
|
- uses: actions/checkout@v4
|
|
68
68
|
with:
|
|
69
69
|
fetch-depth: 0
|
|
70
|
+
filter: blob:none
|
|
71
|
+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
72
|
+
- name: Ensure git history for CodeSentinel
|
|
73
|
+
run: |
|
|
74
|
+
set -euo pipefail
|
|
75
|
+
git fetch --prune --unshallow || true
|
|
76
|
+
BASE_REF="${GITHUB_BASE_REF:-main}"
|
|
77
|
+
git fetch origin "+refs/heads/${BASE_REF}:refs/remotes/origin/${BASE_REF}"
|
|
70
78
|
- name: Run CodeSentinel
|
|
71
79
|
run: npx codesentinel ci --baseline-ref auto --max-repo-score 55 --max-repo-delta 0.03 --no-new-cycles --no-new-high-risk-deps --max-new-hotspots 2 --fail-on error
|
|
72
80
|
```
|
|
73
81
|
|
|
74
|
-
`--baseline-ref auto` requires enough git history to resolve a baseline deterministically. In GitHub Actions, use `fetch-depth: 0
|
|
82
|
+
`--baseline-ref auto` requires enough git history to resolve a baseline deterministically. In GitHub Actions, use `fetch-depth: 0` and ensure the CI base branch ref is fetched.
|
|
83
|
+
|
|
84
|
+
A full workflow template is available at `examples/github-actions/codesentinel-ci.yml`.
|
|
75
85
|
|
|
76
86
|
## Vision
|
|
77
87
|
|
|
@@ -276,6 +286,23 @@ Baseline input modes:
|
|
|
276
286
|
- otherwise: `merge-base(HEAD, origin/main)` then `origin/master`, `main`, `master`
|
|
277
287
|
- `--main-branch <name>` (repeatable) or `--main-branches "main,master,trunk"` customize default branch candidates used by `--baseline-ref auto`.
|
|
278
288
|
|
|
289
|
+
GitHub Actions recommendation for deterministic CI with `--baseline-ref auto`:
|
|
290
|
+
|
|
291
|
+
```yaml
|
|
292
|
+
- uses: actions/checkout@v4
|
|
293
|
+
with:
|
|
294
|
+
fetch-depth: 0
|
|
295
|
+
filter: blob:none
|
|
296
|
+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
297
|
+
|
|
298
|
+
- name: Ensure git history for CodeSentinel
|
|
299
|
+
run: |
|
|
300
|
+
set -euo pipefail
|
|
301
|
+
git fetch --prune --unshallow || true
|
|
302
|
+
BASE_REF="${GITHUB_BASE_REF:-main}"
|
|
303
|
+
git fetch origin "+refs/heads/${BASE_REF}:refs/remotes/origin/${BASE_REF}"
|
|
304
|
+
```
|
|
305
|
+
|
|
279
306
|
Exit codes:
|
|
280
307
|
|
|
281
308
|
- `0`: no failing violations
|
package/package.json
CHANGED