diff --git a/website/reload_website.sh b/website/reload_website.sh index 81fce67655..0da07e3165 100644 --- a/website/reload_website.sh +++ b/website/reload_website.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e . /home/ubuntu/.bashrc export PATH="/usr/local/bin:/usr/bin:/bin" diff --git a/website/reload_with_notification.sh b/website/reload_with_notification.sh index 65213e8552..7931af1b04 100644 --- a/website/reload_with_notification.sh +++ b/website/reload_with_notification.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash . /home/ubuntu/.bashrc export PATH="/usr/local/bin:/usr/bin:/bin" -ERROR=$(sh ./reload_website.sh 2>&1) +ERROR=$(bash ./reload_website.sh 2>&1) if ! [ $? -eq 0 ]; then - data=$( jo text="$(echo "gradio.app is not tracking master :o: \nError:\n\n\`\`\`'$ERROR'\`\`\`")") - echo "$data" - curl -X POST -H 'Content-type: application/json' --data "$data" ${SLACK_WEBHOOK} + DATA=":x: gradio.app is not tracking main, see the error in the replies :arrow_down: <@${MEMBERID}>" + RESPONSE=$(curl https://slack.com/api/chat.postMessage -X POST -H 'Content-type: application/json; charset=utf-8' -H "Authorization: Bearer ${TOKEN}" --data '{"channel":"'${CHANNELID}'", "text":"'"${DATA}"'"}') + THREAD_TS="$( jq -r '.ts' <<< "${RESPONSE}")" + DATA=$( jo text="$(echo "\`\`\`'$ERROR'\`\`\`")" channel=$CHANNELID thread_ts="'$THREAD_TS'") + _=$(curl https://slack.com/api/chat.postMessage -X POST -H 'Content-type: application/json; charset=utf-8' -H "Authorization: Bearer ${TOKEN}" --data "$DATA") fi \ No newline at end of file