Skip to content

Commit 5ff17c9

Browse files
committed
Fix broken pipe.
1 parent b9f6a4e commit 5ff17c9

1 file changed

Lines changed: 23 additions & 18 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -131,41 +131,46 @@ jobs:
131131
printf "All images are optimized without problems.\n" >> "$GITHUB_STEP_SUMMARY"
132132
else
133133
if [ -n "$warnings" ]; then
134-
echo "$warnings" | awk '
135-
match($0, /^##\[warning\]Skipped `([^`]+)` because `([^`]+)`/, arr) {
136-
file = arr[1]
137-
msg = arr[2]
138-
count[msg]++
139-
files[msg] = (files[msg] == "" ? "" : files[msg] "\n") "- `" file "`"
134+
echo "$warnings" | sed -E 's/^##\[warning\]Skipped `(.*)` because `(.*)`/\2|||\1/' \
135+
| awk -F'|||' '
136+
{
137+
msg = $1; file = $2
138+
if (msg != "" && file != "") {
139+
count[msg]++
140+
files[msg] = (files[msg] == "" ? "" : files[msg] "\n") "- `" file "`"
141+
}
140142
}
141143
END {
142144
for (msg in count) {
143145
print "\n> [!WARNING]"
144-
print "> " count[msg] "x Skipped because " msg "\n"
145-
print "<details><summary>Show files</summary>\n"
146+
print "> " count[msg] "x Skipped because: " msg "\n"
147+
print "<details><summary>Show affected files</summary>\n"
146148
print files[msg]
147149
print "\n</details>"
148150
}
149-
}' >> "$GITHUB_STEP_SUMMARY"
151+
}
152+
' >> "$GITHUB_STEP_SUMMARY"
150153
fi
151-
152154
if [ -n "$notices" ]; then
153-
echo "$notices" | awk '
154-
match($0, /^##\[notice\]Optimized `([^`]+)` despite `([^`]+)`/, arr) {
155-
file = arr[1]
156-
msg = arr[2]
157-
count[msg]++
158-
files[msg] = (files[msg] == "" ? "" : files[msg] "\n") "- `" file "`"
155+
echo "$notices" | sed -E 's/^##\[notice\]Optimized `(.*)` despite `(.*)`/\2|||\1/' \
156+
| awk -F'|||' '
157+
{
158+
msg = $1; file = $2
159+
if (msg != "" && file != "") {
160+
count[msg]++
161+
files[msg] = (files[msg] == "" ? "" : files[msg] "\n") "- `" file "`"
162+
}
159163
}
160164
END {
161165
for (msg in count) {
162166
print "\n> [!NOTE]"
163167
print "> Files optimized despite " count[msg] "x " msg "\n"
164-
print "<details><summary>Show files</summary>\n"
168+
print "<details><summary>Show affected files</summary>\n"
165169
print files[msg]
166170
print "\n</details>"
167171
}
168-
}' >> "$GITHUB_STEP_SUMMARY"
172+
}
173+
' >> "$GITHUB_STEP_SUMMARY"
169174
fi
170175
fi
171176

0 commit comments

Comments
 (0)