Skip to content

Commit fd3f6f0

Browse files
committed
fmt
1 parent bbd453c commit fd3f6f0

1 file changed

Lines changed: 28 additions & 4 deletions

File tree

.github/workflows/rpc_healthcheck.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,16 @@ jobs:
130130
overall="OK"
131131
report_dir="${RUNNER_TEMP}/rpc-healthcheck"
132132
133-
table_header='| network | rpc_url | result | error |'
134-
table_sep='|---|---|---|---|'
135133
table_rows=''
134+
html_rows=''
136135
137136
shopt -s nullglob
138137
report_files=("$report_dir"/*.json)
139138
if [[ ${#report_files[@]} -eq 0 ]]; then
140139
overall="FAILED"
141140
send=true
142141
table_rows='| unknown | unknown | failure | missing endpoint report artifact |'
142+
html_rows='<tr><td>unknown</td><td>unknown</td><td>failure</td><td>missing endpoint report artifact</td></tr>'
143143
else
144144
for f in "${report_files[@]}"; do
145145
network="$(jq -r '.network' "$f")"
@@ -163,6 +163,20 @@ jobs:
163163
rpc_url="${rpc_url//|/\\|}"
164164
error="${error//|/\\|}"
165165
table_rows+="| ${network} | ${rpc_url} | ${result} | ${error} |\n"
166+
167+
network_html="${network//&/&amp;}"
168+
network_html="${network_html//</&lt;}"
169+
network_html="${network_html//>/&gt;}"
170+
rpc_url_html="${rpc_url//&/&amp;}"
171+
rpc_url_html="${rpc_url_html//</&lt;}"
172+
rpc_url_html="${rpc_url_html//>/&gt;}"
173+
result_html="${result//&/&amp;}"
174+
result_html="${result_html//</&lt;}"
175+
result_html="${result_html//>/&gt;}"
176+
error_html="${error//&/&amp;}"
177+
error_html="${error_html//</&lt;}"
178+
error_html="${error_html//>/&gt;}"
179+
html_rows+="<tr><td>${network_html}</td><td>${rpc_url_html}</td><td>${result_html}</td><td>${error_html}</td></tr>"
166180
done
167181
fi
168182
@@ -197,11 +211,20 @@ jobs:
197211
echo "Schedule: ${EVENT_SCHEDULE:-N/A}" >> "$GITHUB_OUTPUT"
198212
echo "Run: $RUN_URL" >> "$GITHUB_OUTPUT"
199213
echo >> "$GITHUB_OUTPUT"
200-
echo "$table_header" >> "$GITHUB_OUTPUT"
201-
echo "$table_sep" >> "$GITHUB_OUTPUT"
214+
echo "| network | rpc_url | result | error |" >> "$GITHUB_OUTPUT"
215+
echo "|---|---|---|---|" >> "$GITHUB_OUTPUT"
202216
printf "%b" "$table_rows" >> "$GITHUB_OUTPUT"
203217
echo "EOF" >> "$GITHUB_OUTPUT"
204218
219+
echo "html_body<<EOF" >> "$GITHUB_OUTPUT"
220+
echo "<p>QuarkChain RPC Healthcheck: <b>${overall}</b></p>" >> "$GITHUB_OUTPUT"
221+
echo "<p>Event: ${EVENT_NAME}<br/>Schedule: ${EVENT_SCHEDULE:-N/A}<br/>Run: <a href=\"${RUN_URL}\">${RUN_URL}</a></p>" >> "$GITHUB_OUTPUT"
222+
echo "<table border=\"1\" cellpadding=\"6\" cellspacing=\"0\" style=\"border-collapse: collapse;\">" >> "$GITHUB_OUTPUT"
223+
echo "<thead><tr><th>network</th><th>rpc_url</th><th>result</th><th>error</th></tr></thead>" >> "$GITHUB_OUTPUT"
224+
echo "<tbody>${html_rows}</tbody>" >> "$GITHUB_OUTPUT"
225+
echo "</table>" >> "$GITHUB_OUTPUT"
226+
echo "EOF" >> "$GITHUB_OUTPUT"
227+
205228
- name: Send email
206229
if: ${{ steps.compose.outputs.send == 'true' }}
207230
uses: dawidd6/action-send-mail@v6
@@ -214,3 +237,4 @@ jobs:
214237
to: ${{ secrets.RPC_HEALTHCHECK_EMAIL_TO }}
215238
subject: ${{ steps.compose.outputs.subject }}
216239
body: ${{ steps.compose.outputs.body }}
240+
html_body: ${{ steps.compose.outputs.html_body }}

0 commit comments

Comments
 (0)