-
Notifications
You must be signed in to change notification settings - Fork 3
29 lines (27 loc) · 1.14 KB
/
telegram-notification.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
name: Telegram Notification on Commit
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Send Telegram Message
run: |
MESSAGE="🚀 *GitHub Action Triggered!*\n"
MESSAGE+="🔖 *Event:* ${{ github.event_name }}\n"
MESSAGE+="🌐 *Repository:* [${{ github.repository }}](${{ github.server_url }}/${{ github.repository }})\n"
MESSAGE+="🔗 *Branch:* ${{ github.ref }}\n"
MESSAGE+="👤 *Actor:* [${{ github.actor }}](${{ github.server_url }}/${{ github.actor }})\n"
MESSAGE+="💬 *Commit Message:* '${{ github.event.head_commit.message }}'\n"
curl -X POST \
https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage \
-H 'Content-Type: application/json' \
-d "{\"message_thread_id\": \"519\", \"chat_id\": \"${{ secrets.TELEGRAM_CHAT_ID }}\", \"text\": \"$MESSAGE\", \"parse_mode\": \"Markdown\"}"
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}