-
Notifications
You must be signed in to change notification settings - Fork 1
106 lines (88 loc) · 2.95 KB
/
Copy pathci.yml
File metadata and controls
106 lines (88 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: CI
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 24
- run: npm ci
- run: npm run lint
- run: npm test
- run: npm run test:coverage
- name: Holdout gate (ClawGuard-local)
run: npm run holdout:gate -- --skip-doctrine
- name: Scanner benchmark
run: |
npm run bench:scanner
npm run bench:render
action-smoke:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- id: clawguard
uses: ./
with:
target: examples/declared-api-skill
policy: governed
fail-on: none
fail-on-policy: "false"
sarif: clawguard-smoke.sarif
check: "true"
check-output: clawguard-smoke.check.json
- run: test -s clawguard-smoke.sarif
- run: test -s clawguard-smoke.check.json
- name: Assert clawguard.check.v1 contract
run: |
node -e '
const fs = require("node:fs");
const payload = JSON.parse(fs.readFileSync("clawguard-smoke.check.json", "utf8"));
if (payload.schemaVersion !== "clawguard.check.v1") {
throw new Error("schemaVersion mismatch: " + payload.schemaVersion);
}
const required = ["decision", "risk", "summary", "recommendedAction", "policyPreset", "findingSummary", "findings"];
for (const key of required) {
if (!(key in payload)) {
throw new Error("missing required field: " + key);
}
}
const allowedDecisions = ["allow", "manual_review", "block"];
if (!allowedDecisions.includes(payload.decision)) {
throw new Error("invalid decision: " + payload.decision);
}
console.log("clawguard.check.v1 payload OK: decision=" + payload.decision + " risk=" + payload.risk);
'
- name: Assert action outputs
env:
DECISION: ${{ steps.clawguard.outputs.decision }}
RISK: ${{ steps.clawguard.outputs.risk }}
CHECK_JSON_PATH: ${{ steps.clawguard.outputs.check-json-path }}
SARIF_PATH: ${{ steps.clawguard.outputs.sarif-path }}
run: |
if [ -z "$DECISION" ]; then
echo "decision output was empty"
exit 1
fi
if [ -z "$RISK" ]; then
echo "risk output was empty"
exit 1
fi
if [ -z "$CHECK_JSON_PATH" ]; then
echo "check-json-path output was empty"
exit 1
fi
if [ -z "$SARIF_PATH" ]; then
echo "sarif-path output was empty"
exit 1
fi
test -s "$CHECK_JSON_PATH"
test -s "$SARIF_PATH"
echo "outputs OK: decision=$DECISION risk=$RISK"