From 8af57d4cfc298d1fdcb5a24be279fd08fed48c18 Mon Sep 17 00:00:00 2001 From: Juarez Rudsatz Date: Mon, 23 Sep 2024 17:51:17 -0300 Subject: [PATCH] refactor(ci): improve summary report formatting --- .github/actions/workflow-info/action.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/actions/workflow-info/action.yaml b/.github/actions/workflow-info/action.yaml index 474af0c..3c899c5 100644 --- a/.github/actions/workflow-info/action.yaml +++ b/.github/actions/workflow-info/action.yaml @@ -40,7 +40,7 @@ runs: local text; if ! text="$(cat -)"; then printf 'Failed to dump context for %s\n' "${1:-Unknown}" >> "${GITHUB_STEP_SUMMARY}"; fi text="${text#"${text%%[![:space:]]*}"}" - if test -n "${text:-}"; then + if test "${#text}" -gt 3; then printf '\n### %s Context\n\n\n```json\n%s\n```\n' "${1:-Unknown}" "${text:-Nothing in context}" >> "${GITHUB_STEP_SUMMARY}"; fi echo "::endgroup::"; @@ -52,7 +52,10 @@ runs: echo '- github.sha: ${{ github.sha }}' >> "${GITHUB_STEP_SUMMARY}"; echo "${REPORT_PARAMS:-}" | dump_ctx "Parameters"; - echo "${REPORT_CONTENT:-}" | dump_ctx "Job"; + if test -n "${REPORT_CONTENT:-}"; then + printf '\n## Summary\n\n' >> "${GITHUB_STEP_SUMMARY}"; + echo "${REPORT_CONTENT:-}" >> "${GITHUB_STEP_SUMMARY}"; + fi printf '\n## Context Information\n' >> "${GITHUB_STEP_SUMMARY}"; echo '${{ toJson(runner) }}' | dump_ctx "Runner";