-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (45 loc) · 2.02 KB
/
notify.yml
File metadata and controls
48 lines (45 loc) · 2.02 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: 🚀 GitHub to Telegram Notification
on: [push]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: 📩 Telegram Notification
env:
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_TO }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
COMMIT_MSG: ${{ github.event.commits[0].message }}
REPO: ${{ github.repository }}
BRANCH: ${{ github.ref }}
COMMIT_URL: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
PROFILE_URL: https://github.com/${{ github.actor }}
USER: ${{ github.actor }}
run: |
# Konversi waktu ke Tokyo Time (JST, UTC+9)
JST_TIMESTAMP=$(TZ="Asia/Tokyo" date -d "${{ github.event.head_commit.timestamp }}" "+%Y-%m-%d %H:%M:%S JST")
# Ambil total commit count
TOTAL_COMMITS=$(curl -s "https://api.github.com/repos/${{ github.repository }}/commits?per_page=1" | jq length)
# Kirim notifikasi ke Telegram
curl -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage" \
-H "Content-Type: application/json" \
-d '{
"chat_id": "'$TELEGRAM_CHAT_ID'",
"text": "
🚀 *New Commit Pushed!*\n
———————————————\n
🏷️ *Commit by:* `'"$USER"'`\n
📂 *Repository:* `'"$REPO"'`\n
🌿 *Branch:* `'"$BRANCH"'`\n
🛠️ *Total Commits:* `'"$TOTAL_COMMITS"'`\n
⏳ *Pushed at:* `'"$JST_TIMESTAMP"'`\n
———————————————\n
📝 *Commit Message:*\n
```\n'"$COMMIT_MSG"'\n```\n
",
"parse_mode": "Markdown",
"disable_web_page_preview": true,
"reply_markup": "{\"inline_keyboard\": [
[{\"text\": \"👤 View Profile\", \"url\": \"'"$PROFILE_URL"'\"}],
[{\"text\": \"🔗 View Commit Details\", \"url\": \"'"$COMMIT_URL"'\"}]
]}"
}'