2022-04-20 16:14:48 +08:00
|
|
|
#!/bin/bash
|
2022-03-11 21:15:24 +08:00
|
|
|
. /home/ubuntu/.bashrc
|
|
|
|
export PATH="/usr/local/bin:/usr/bin:/bin"
|
|
|
|
|
2022-09-24 04:39:01 +08:00
|
|
|
OUTPUT=$(bash ./reload_website.sh 2>&1)
|
2022-03-11 21:15:24 +08:00
|
|
|
|
|
|
|
if ! [ $? -eq 0 ]; then
|
2022-09-24 04:39:01 +08:00
|
|
|
OUTPUT=${OUTPUT: -2000}
|
2022-04-20 16:14:48 +08:00
|
|
|
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}")"
|
2022-09-24 04:39:01 +08:00
|
|
|
DATA=$( jo text="$(echo "\`\`\`'$OUTPUT'\`\`\`")" channel=$CHANNELID thread_ts="'$THREAD_TS'")
|
2022-04-20 16:14:48 +08:00
|
|
|
_=$(curl https://slack.com/api/chat.postMessage -X POST -H 'Content-type: application/json; charset=utf-8' -H "Authorization: Bearer ${TOKEN}" --data "$DATA")
|
2022-09-24 04:39:01 +08:00
|
|
|
elif [[ $OUTPUT == *"NO CHANGES"* ]]; then
|
|
|
|
:
|
2022-09-16 16:23:40 +08:00
|
|
|
else
|
|
|
|
LATEST=$(git log -1 | fgrep commit)$(git log -1 | tail -1)
|
2022-09-24 04:39:01 +08:00
|
|
|
curl -X POST -H 'Content-type: application/json' --data '{"text":"gradio.app reloaded successfully! :ship:\n\n Latest live commit:\n>`'"${LATEST}"'`"}' ${SLACK_WEBHOOK}
|
2022-04-21 02:04:30 +08:00
|
|
|
fi
|