-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (88 loc) · 2.92 KB
/
git.commit.message.yml
File metadata and controls
104 lines (88 loc) · 2.92 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# ==========================================
# 📢 Notify Workflow Dev Push
# ------------------------------------------
# Tujuan:
# - Kirim notifikasi ke Telegram saat ada push
# - Bisa dipanggil ulang (reusable workflow)
#
# Trigger:
# - push ke branch main
# - manual (workflow_dispatch)
# - reusable (workflow_call)
#
# Flow:
# 1. Terima input message (private / channel)
# 2. Cek apakah message tersedia
# 3. Kirim ke Telegram (private / channel)
# ==========================================
name: Notify Workflow Dev Push
on:
workflow_dispatch:
push:
branches: [main]
paths-ignore:
- README.md
- .github/*.md
workflow_call:
inputs:
private_message:
required: false
type: string
channel_message:
required: false
type: string
secrets:
TELEGRAM_TOKEN:
required: true
TELEGRAM_CHAT_ID:
required: false
TELEGRAM_CHANNEL_ID:
required: false
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: 📤 Send Telegram Message
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
TELEGRAM_CHANNEL_ID: ${{ secrets.TELEGRAM_CHANNEL_ID }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
PRIVATE_MESSAGE: ${{ inputs.private_message }}
CHANNEL_MESSAGE: ${{ inputs.channel_message }}
run: |
echo "=============================="
echo "📢 Telegram Notification Start"
echo "=============================="
echo "📦 Repo : $GITHUB_REPOSITORY"
echo "🌿 Branch : $GITHUB_REF_NAME"
echo "👤 Actor : $GITHUB_ACTOR"
# =========================
# 💜 PRIVATE MESSAGE
# =========================
if [ ! -z "$PRIVATE_MESSAGE" ]; then
echo "💬 Sending private message..."
curl -s -X POST https://api.telegram.org/bot$TELEGRAM_TOKEN/sendMessage \
-d chat_id=$TELEGRAM_CHAT_ID \
-d "disable_web_page_preview=true" \
--data-urlencode "text=$PRIVATE_MESSAGE"
echo "✅ Private message sent"
else
echo "⚠️ No private message"
fi
# =========================
# 📢 CHANNEL MESSAGE
# =========================
if [ ! -z "$CHANNEL_MESSAGE" ]; then
echo "📣 Sending channel message..."
curl -s -X POST https://api.telegram.org/bot$TELEGRAM_TOKEN/sendMessage \
-d chat_id=$TELEGRAM_CHANNEL_ID \
-d "parse_mode=Markdown" \
-d "disable_web_page_preview=true" \
--data-urlencode "text=$CHANNEL_MESSAGE"
echo "✅ Channel message sent"
else
echo "⚠️ No channel message"
fi
echo "=============================="
echo "⏹️ Notification Finished"
echo "=============================="