Skip to content

Commit 54837d4

Browse files
cameroncookecodex
andcommitted
ci: Publish Warden sweep results
Add a job summary for scheduled Warden sweeps so runs show whether findings were produced. Upload the findings JSON as an artifact for follow-up inspection when no PRs are created. Co-Authored-By: OpenAI Codex <noreply@openai.com>
1 parent 71cef97 commit 54837d4

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

.github/workflows/warden-sweep.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,62 @@ jobs:
2525
- uses: getsentry/warden@v0
2626
with:
2727
anthropic-api-key: ${{ secrets.WARDEN_ANTHROPIC_API_KEY }}
28+
29+
- name: Summarize Warden results
30+
if: always()
31+
env:
32+
FINDINGS_PATH: ${{ runner.temp }}/warden-findings.json
33+
run: |
34+
{
35+
echo "## Warden Sweep"
36+
echo
37+
echo "- Run: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
38+
39+
if [[ ! -f "${FINDINGS_PATH}" ]]; then
40+
echo "- Findings file: not found"
41+
exit 0
42+
fi
43+
44+
echo "- Findings artifact: \`warden-findings\`"
45+
node --input-type=module <<'NODE'
46+
import fs from 'node:fs';
47+
48+
const findingsPath = process.env.FINDINGS_PATH;
49+
const raw = fs.readFileSync(findingsPath, 'utf8');
50+
const payload = JSON.parse(raw);
51+
const findings = Array.isArray(payload)
52+
? payload
53+
: Array.isArray(payload.findings)
54+
? payload.findings
55+
: [];
56+
const total = typeof payload.totalFindings === 'number' ? payload.totalFindings : findings.length;
57+
58+
console.log(`- Total findings: ${total}`);
59+
60+
if (findings.length > 0) {
61+
console.log('');
62+
console.log('| Severity | Skill | File | Title |');
63+
console.log('|---|---|---|---|');
64+
for (const finding of findings.slice(0, 20)) {
65+
const severity = finding.severity ?? '';
66+
const skill = finding.skill ?? '';
67+
const file = finding.filePath ?? finding.file ?? '';
68+
const title = String(finding.title ?? finding.message ?? '').replaceAll('|', '\\|');
69+
console.log(`| ${severity} | ${skill} | \`${file}\` | ${title} |`);
70+
}
71+
if (findings.length > 20) {
72+
console.log(`\nShowing first 20 of ${findings.length} findings. Download the artifact for the full JSON.`);
73+
}
74+
} else {
75+
console.log('- Result: no findings');
76+
}
77+
NODE
78+
} >> "${GITHUB_STEP_SUMMARY}"
79+
80+
- name: Upload Warden findings
81+
if: always()
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: warden-findings
85+
path: ${{ runner.temp }}/warden-findings.json
86+
if-no-files-found: warn

0 commit comments

Comments
 (0)