diff --git a/action.yml b/action.yml
index d7e3e1a..5822310 100644
--- a/action.yml
+++ b/action.yml
@@ -92,6 +92,9 @@ runs:
- name: Generate Summary
if: always()
shell: bash
+ env:
+ CONFIG_PATH: ${{ inputs.config }}
+ RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
REPORT="/tmp/structlint-report.json"
if [ ! -f "$REPORT" ]; then
@@ -101,40 +104,47 @@ runs:
SUCCESSES=$(jq -r '.successes' "$REPORT")
FAILURES=$(jq -r '.failures' "$REPORT")
+ TOTAL=$((SUCCESSES + FAILURES))
- if [ "$FAILURES" -eq 0 ]; then
- STATUS_ICON="✅"
- STATUS_TEXT="All checks passed"
- else
- STATUS_ICON="❌"
- STATUS_TEXT="${FAILURES} violation(s) found"
- fi
-
- # Build markdown
{
- echo "## ${STATUS_ICON} StructLint Validation"
- echo ""
- echo "| Metric | Count |"
- echo "|--------|-------|"
- echo "| Checks passed | ${SUCCESSES} |"
- echo "| Violations | ${FAILURES} |"
- } > /tmp/structlint-md.tmp
- MD=$(cat /tmp/structlint-md.tmp)
-
- # Add violations detail if any
- if [ "$FAILURES" -gt 0 ]; then
- VIOLATIONS=$(jq -r '.summary.violations[]? | "### ⚠️ \(.description) (\(.count))\n" + ([.examples[]? | "- `\(.)`"] | join("\n")) + "\n"' "$REPORT")
- {
+ if [ "$FAILURES" -eq 0 ]; then
+ echo "## StructLint — All checks passed"
echo ""
- echo ""
- echo "Violation Details
"
+ echo "**${SUCCESSES}** rules validated against \`${CONFIG_PATH}\`. No violations found."
+ else
+ echo "## StructLint — ${FAILURES} violation(s) found"
echo ""
- echo "$VIOLATIONS"
+ echo "**${SUCCESSES}**/${TOTAL} rules passed · **${FAILURES}** violation(s) detected against \`${CONFIG_PATH}\`."
echo ""
- echo " "
- } >> /tmp/structlint-md.tmp
- MD=$(cat /tmp/structlint-md.tmp)
- fi
+
+ # Render each violation category
+ jq -r '.summary.violations[]? | @json' "$REPORT" | while IFS= read -r v; do
+ DESC=$(echo "$v" | jq -r '.description')
+ COUNT=$(echo "$v" | jq -r '.count')
+ EXAMPLES=$(echo "$v" | jq -r '.examples[]?')
+ EXAMPLE_COUNT=$(echo "$v" | jq -r '.examples | length')
+
+ echo ""
+ echo "${DESC} (${COUNT})
"
+ echo ""
+ echo "$EXAMPLES" | while IFS= read -r ex; do
+ echo "- \`${ex}\`"
+ done
+ if [ "$COUNT" -gt "$EXAMPLE_COUNT" ]; then
+ REMAINING=$((COUNT - EXAMPLE_COUNT))
+ echo "- _…and ${REMAINING} more_"
+ fi
+ echo ""
+ echo " "
+ echo ""
+ done
+ fi
+
+ echo "---"
+ echo "View full run · Powered by StructLint"
+ } > /tmp/structlint-md.tmp
+
+ MD=$(cat /tmp/structlint-md.tmp)
# Write to job summary
echo "$MD" >> "$GITHUB_STEP_SUMMARY"