Skip to content

Commit 9333803

Browse files
committed
Job summary: compact per-type totals table + collapsed detail
1 parent 75ef769 commit 9333803

1 file changed

Lines changed: 43 additions & 8 deletions

File tree

‎.github/workflows/cycode-scan.yml‎

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -328,21 +328,56 @@ jobs:
328328
echo "- **Severity threshold:** \`$SEVERITY_THRESHOLD\`"
329329
echo "- **Block on findings:** \`$BLOCK_ON_FINDINGS\`"
330330
echo ""
331+
echo "### Findings by scan type"
332+
echo ""
333+
echo "| Scan type | Critical | High | Medium | Low | Info | Total |"
334+
echo "| --- | --- | --- | --- | --- | --- | --- |"
331335
} >> "$GITHUB_STEP_SUMMARY"
332336
337+
# Compact totals table — one row per scan type, counted by severity
338+
# from the raw JSON. Keeps the summary readable no matter how many
339+
# findings; full per-finding detail stays in the uploaded artifact.
333340
for scan_type in $(echo "$SCAN_TYPES_INPUT" | jq -r '.[]'); do
334-
SUMMARY_MD="$SUMMARY_DIR/cycode-$scan_type.md"
335-
if [ -s "$SUMMARY_MD" ]; then
336-
cat "$SUMMARY_MD" >> "$GITHUB_STEP_SUMMARY"
337-
echo "" >> "$GITHUB_STEP_SUMMARY"
341+
JSON_FILE="$OUT_DIR/cycode-$scan_type.json"
342+
if [ -s "$JSON_FILE" ]; then
343+
read -r C H M L I T <<< "$(jq -r '
344+
[(.scan_results[]?.detections[]?), (.detections[]?)]
345+
| map((.severity // .detection_details.severity // "info") | ascii_downcase)
346+
| [ (map(select(.=="critical"))|length),
347+
(map(select(.=="high"))|length),
348+
(map(select(.=="medium"))|length),
349+
(map(select(.=="low"))|length),
350+
(map(select(.=="info"))|length),
351+
length ] | @tsv' "$JSON_FILE")"
352+
echo "| \`$scan_type\` | $C | $H | $M | $L | $I | **$T** |" >> "$GITHUB_STEP_SUMMARY"
338353
else
339-
echo "### Cycode $scan_type" >> "$GITHUB_STEP_SUMMARY"
340-
echo "" >> "$GITHUB_STEP_SUMMARY"
341-
echo "_Scan output missing or report generation failed. See step logs._" >> "$GITHUB_STEP_SUMMARY"
342-
echo "" >> "$GITHUB_STEP_SUMMARY"
354+
echo "| \`$scan_type\` | - | - | - | - | - | _no output_ |" >> "$GITHUB_STEP_SUMMARY"
343355
fi
344356
done
345357
358+
{
359+
echo ""
360+
echo "_Full per-finding detail is in the **cycode-scan-results** artifact (json/csv/html) attached to this run._"
361+
echo ""
362+
} >> "$GITHUB_STEP_SUMMARY"
363+
364+
# Detailed per-type reports, collapsed so they never bury the table.
365+
for scan_type in $(echo "$SCAN_TYPES_INPUT" | jq -r '.[]'); do
366+
SUMMARY_MD="$SUMMARY_DIR/cycode-$scan_type.md"
367+
{
368+
echo "<details><summary>Cycode ${scan_type} — detailed findings</summary>"
369+
echo ""
370+
if [ -s "$SUMMARY_MD" ]; then
371+
cat "$SUMMARY_MD"
372+
else
373+
echo "_Scan output missing or report generation failed. See step logs._"
374+
fi
375+
echo ""
376+
echo "</details>"
377+
echo ""
378+
} >> "$GITHUB_STEP_SUMMARY"
379+
done
380+
346381
# ---- Emit per-finding ::error annotations -------------------------
347382
# One annotation per detection at or above severityThreshold. These
348383
# render inline in the file diff on the run page and at the top of

0 commit comments

Comments
 (0)