Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion website/reload_website.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export PATH="/usr/local/bin:/usr/bin:/bin"
git pull > /tmp/git_changes.txt

if grep -q "Already up to date." /tmp/git_changes.txt; then
echo "Already up to date. No reload."
echo "NO CHANGES"
else
echo "Reloading..."
docker-compose build
Expand Down
10 changes: 5 additions & 5 deletions website/reload_with_notification.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
. /home/ubuntu/.bashrc
export PATH="/usr/local/bin:/usr/bin:/bin"

ERROR=$(bash ./reload_website.sh 2>&1)
OUTPUT=$(bash ./reload_website.sh 2>&1)

if ! [ $? -eq 0 ]; then
ERROR=${ERROR: -2000}
OUTPUT=${OUTPUT: -2000}
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'")
DATA=$( jo text="$(echo "\`\`\`'$OUTPUT'\`\`\`")" 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")
elif [ "$ERROR" = "Already up to date. No reload." ]; then
:
elif [[ $OUTPUT == *"NO CHANGES"* ]]; then
:
else
LATEST=$(git log -1 | fgrep commit)$(git log -1 | tail -1)
curl -X POST -H 'Content-type: application/json' --data '{"text":"gradio.app relaoded successfully! :ship:\n\n Latest live commit:\n>`'"${LATEST}"'`"}' ${SLACK_WEBHOOK}
Expand Down