From cbb14f72119e88340bd5c638fada7e729eb6b74e Mon Sep 17 00:00:00 2001 From: Vanessa Freudenberg Date: Tue, 5 Mar 2024 23:40:48 -0800 Subject: [PATCH] Update build-pages.sh --- scripts/build-pages.sh | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/scripts/build-pages.sh b/scripts/build-pages.sh index 1933afa5..8b626aa4 100755 --- a/scripts/build-pages.sh +++ b/scripts/build-pages.sh @@ -12,6 +12,7 @@ rm -rf _site mkdir _site LINKS=() FAILED=() +SUCCESS=() TOP=$(git rev-parse --show-toplevel) for DIR in tutorials examples ; do cd $TOP @@ -31,6 +32,7 @@ for DIR in tutorials examples ; do if [ $BUILD_ERROR -eq 0 ] ; then mv -v dist ../../_site/$APP LINKS+=("

${DATE} ${APP} (log)

") + SUCCESS+=($APP) else mkdir ../../_site/$APP echo "

Build failed

" > ../../_site/$APP/index.html
@@ -78,17 +80,20 @@ cat > _site/index.html <
 EOF
 
-NUM_FAILED=${#FAILED[@]}
-if [ $NUM_FAILED -gt 0 ] ; then
-    if [ -n "$SLACK_HOOK_URL" ] ; then
-        echo
-        echo "=== Sending slack message ==="
-        URL="https://croquet.github.io/worldcore/"
-        APPS=$(printf -- "- %s\\\\n" "${FAILED[@]}")
-        JSON="{\"text\": \"🤖 *Worldcore build failed for ${NUM_FAILED} apps* 🤖\n${URL}\n${APPS}\""
-        curl -X POST -H 'Content-type: application/json' --data "${JSON}\"}" $SLACK_HOOK_URL
+if [ -n "$SLACK_HOOK_URL" ] ; then
+    echo
+    echo "=== Sending slack message ==="
+    URL="https://croquet.github.io/worldcore/"
+    NUM_FAILED=${#FAILED[@]}
+    NUM_TOTAL=$((${#SUCCESS[@]} + ${#FAILED[@]}))
+    if [ $NUM_FAILED -eq 0 ] ; then
+        JSON="{\"text\": \"😍 *Worldcore build succeeded for all apps* 😍\n${URL}\"}"
     else
-        echo
-        echo "=== No SLACK_HOOK_URL set, not sending slack message ==="
+        APPS=$(printf "• %s\\\\n" "${FAILED[@]}")
+        JSON="{\"text\": \"💩 *Worldcore builds failed for ${NUM_FAILED}/${NUM_TOTAL} apps* 💩\n${URL}\n${APPS}\"}"
     fi
+    curl -sSX POST -H 'Content-type: application/json' --data "${JSON}" $SLACK_HOOK_URL
+else
+    echo
+    echo "=== No SLACK_HOOK_URL set, not sending slack message ==="
 fi