Skip to content

Commit d727cef

Browse files
chore(ci): harden slack payload and webhook retries
Co-authored-by: Nick Perez <[email protected]>
1 parent ba8523d commit d727cef

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

.github/workflows/fresh-install-tests.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,20 @@ jobs:
9595
fi
9696
9797
run_url="https://github.com/${REPOSITORY}/actions/runs/${RUN_ID}"
98-
payload=$(cat <<EOF
99-
{
100-
"text": ":warning: Fresh Install Tests failed in *${REPOSITORY}* on branch *${BRANCH}*.\n*Workflow:* ${WORKFLOW}\n*Run:* <${run_url}|#${RUN_NUMBER} (attempt ${RUN_ATTEMPT})>\n*Failed step:* ${failed_step}"
101-
}
102-
EOF
103-
)
98+
message=$(printf '%s\n%s\n%s\n%s' \
99+
":warning: Fresh Install Tests failed in *${REPOSITORY}* on branch *${BRANCH}*." \
100+
"*Workflow:* ${WORKFLOW}" \
101+
"*Run:* <${run_url}|#${RUN_NUMBER} (attempt ${RUN_ATTEMPT})>" \
102+
"*Failed step:* ${failed_step}")
103+
payload=$(jq --compact-output --null-input --arg text "$message" '{text: $text}')
104104
105105
curl -sS -X POST \
106+
--fail \
107+
--retry 4 \
108+
--retry-all-errors \
109+
--retry-max-time 60 \
110+
--connect-timeout 10 \
111+
--max-time 30 \
106112
-H "Content-type: application/json" \
107113
--data "$payload" \
108114
"$SLACK_WEBHOOK_URL"

0 commit comments

Comments
 (0)