Skip to content

Commit

Permalink
errors in a thread, new chatmessage api (#1037)
Browse files Browse the repository at this point in the history
  • Loading branch information
aliabd authored Apr 20, 2022
1 parent ef8b972 commit db48131
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion website/reload_website.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -e
. /home/ubuntu/.bashrc
export PATH="/usr/local/bin:/usr/bin:/bin"
Expand Down
12 changes: 7 additions & 5 deletions website/reload_with_notification.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit db48131

Please sign in to comment.