From 10d631555c66640d13c365afb0e1af618cc7ccb7 Mon Sep 17 00:00:00 2001 From: "Marten (msc)" Date: Sun, 25 Aug 2024 15:56:18 -0500 Subject: [PATCH] [ADD] health check at the end of CI/CD gh action --- .github/workflows/ssh-deploy.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/ssh-deploy.yml b/.github/workflows/ssh-deploy.yml index a843575..d2b7f82 100644 --- a/.github/workflows/ssh-deploy.yml +++ b/.github/workflows/ssh-deploy.yml @@ -50,3 +50,16 @@ jobs: # Restart the process screen -S $SCREEN_SESSION -X stuff 'python bot.py\n' EOF + + - name: Health check + env: + BOT_TOKEN: ${{ secrets.BOT_TOKEN }} + run: | + sleep 10 # Wait for the bot to start + response=$(curl -s "https://api.telegram.org/bot$BOT_TOKEN/getMe") + if [[ $response == *"\"ok\":true"* ]]; then + echo "Bot is up and running" + else + echo "Bot health check failed" + exit 1 + fi