Skip to content

Commit

Permalink
workflow refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrszacilowski committed Jul 18, 2024
1 parent 1595ad8 commit 295cb40
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,20 @@ jobs:
- name: Send Notification to Telegram
if: env.TG_SENDER_PAYLOAD_MESSAGE != '' && success()
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.BOTTOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.CHATID }}
run: |
curl -X POST \
-H "Content-Type: application/json" \
-d '{"chat_id": "${{ secrets.CHATID }}", "text": "${{ env.TG_SENDER_PAYLOAD_MESSAGE }}"}' \
"https://api.telegram.org/bot${{ secrets.BOTTOKEN }}/sendMessage"
response=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
-H "Content-Type: application/json" \
-d "{\"chat_id\": \"$TELEGRAM_CHAT_ID\", \"text\": \"$TG_SENDER_PAYLOAD_MESSAGE\"}" \
"https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage")
if [ "$response" = "200" ]; then
echo "Message sent successfully"
else
echo "Failed to send message. HTTP status code: $response"
exit 1
fi
# if: env.TG_SENDER_PAYLOAD_MESSAGE != '' && success()
# run: |
Expand Down

0 comments on commit 295cb40

Please sign in to comment.