@@ -118,18 +118,30 @@ jobs:
118118
119119 - name : Summarize the optimization run
120120 run : |
121- echo '# Optimization run' >> "$GITHUB_STEP_SUMMARY"
121+ printf '# Optimization run\n ' >> "$GITHUB_STEP_SUMMARY"
122122 opt_log=$(gh run view $deploy_run_id -j $optimize_job_id -R originlab/${{ matrix.site }} --log \
123123 | awk '/find pages\// {f=1} /upload-artifact/ {f=0} f' \
124124 | cut -f3- | cut -d' ' -f2- \
125125 | sed -E -e 's/\r//g' -e 's/\^\[\[[0-9;]*[a-zA-Z]//g')
126126
127- echo "$opt_log" | grep '^##\[warning\]' | sed -E 's/^##\[warning\](.*)/\n> [!WARNING]\n> \1/' >> "$GITHUB_STEP_SUMMARY"
128-
129- if echo "$opt_log" | grep -q '^##\[notice\]'; then
130- echo -e "\n<details><summary>Notices</summary><pre>" >> "$GITHUB_STEP_SUMMARY"
131- echo "$opt_log" | grep '^##\[notice\]' | sed -E 's/^##\[notice\](.*)/- \1\n/' >> "$GITHUB_STEP_SUMMARY"
132- echo -e "\n</pre></details>" >> "$GITHUB_STEP_SUMMARY"
127+ warnings=$(echo "$opt_log" | grep '^##\[warning\]' || true)
128+ notices=$(echo "$opt_log" | grep '^##\[notice\]' || true)
129+
130+ if [ -z "$warnings" ] && [ -z "$notices" ]; then
131+ printf "All images are optimized without problems.\n" >> "$GITHUB_STEP_SUMMARY"
132+ else
133+ if [ -n "$warnings" ]; then
134+ echo "$warnings" | sed -E 's/^##\[warning\](.*)/\n> [!WARNING]\n> \1\n/' >> "$GITHUB_STEP_SUMMARY"
135+ fi
136+
137+ if [ -n "$notices" ]; then
138+ {
139+ echo -e '> [!NOTE]\n> Some files had warnings\n'
140+ echo -e '<details><summary>Details</summary><pre>\n'
141+ echo "$notices" | sed -E 's/^##\[notice\](.*)/- \1\n/'
142+ echo -e "</pre></details>"
143+ } >> "$GITHUB_STEP_SUMMARY"
144+ fi
133145 fi
134146
135147 - name : Summarize artifacts
0 commit comments