action summary

This commit is contained in:
ychangkim
2026-07-22 17:43:34 +09:00
parent d6183e98c7
commit d2d20ce3b2
+17 -12
View File
@@ -196,19 +196,24 @@ jobs:
with open(out_path, "w") as f:
json.dump(results, f)
print(json.dumps(results, indent=2))
PY
python3 -c '
import json, os, sys
with open(sys.argv[1]) as f:
data = json.load(f)
print("### 🛡️ CVE 스캔 결과 요약\n")
print("| Catalog | Version | Image | Critical | High | Medium | Low | Summary |")
print("| --- | --- | --- | --- | --- | --- | --- | --- |")
for item in data:
summary = item.get("summary", "").replace("|", "\\|")
print(f"| {item.get(\"catalog\", \"-\")} | {item.get(\"version\", \"-\")} | `{item.get(\"image\", \"-\")}` | {item.get(\"critical\", 0)} | {item.get(\"high\", 0)} | {item.get(\"medium\", 0)} | {item.get(\"low\", 0)} | {summary} |")
' "$OUT_DIR/cve-summary.json" >> "$GITHUB_STEP_SUMMARY"
step_summary = os.environ.get("GITHUB_STEP_SUMMARY")
if step_summary:
with open(step_summary, "a") as sf:
sf.write("### 🛡️ CVE 스캔 결과 요약\n\n")
sf.write("| Catalog | Version | Image | Critical | High | Medium | Low | Summary |\n")
sf.write("| --- | --- | --- | --- | --- | --- | --- | --- |\n")
for r in results:
cat = r.get("catalog") or "-"
ver = r.get("version") or "-"
img = r.get("image") or "-"
crit = r.get("critical", 0)
high = r.get("high", 0)
med = r.get("medium", 0)
low = r.get("low", 0)
summ = (r.get("summary") or "").replace("|", "\\|")
sf.write(f"| {cat} | {ver} | `{img}` | {crit} | {high} | {med} | {low} | {summ} |\n")
PY
- name: CVE 스캔 결과 전송