build: replace Telegram notification plugin with a custom curl command.
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
@@ -40,29 +40,33 @@ steps:
|
||||
branch: master
|
||||
event: push
|
||||
|
||||
# 3. Notification (Jalan saat sukses maupun gagal)
|
||||
# 3. Notification (Menggunakan cURL untuk memastikan masuk Topik 8)
|
||||
notify-telegram:
|
||||
image: appleboy/drone-telegram
|
||||
settings:
|
||||
token:
|
||||
image: alpine
|
||||
environment:
|
||||
TELEGRAM_TOKEN:
|
||||
from_secret: telegram_token
|
||||
to:
|
||||
TELEGRAM_CHAT_ID:
|
||||
from_secret: telegram_chat_id
|
||||
message_thread_id: 8
|
||||
format: html
|
||||
message: |
|
||||
{{#success build.status}}
|
||||
✅ <b>Deployment SUCCESS!</b>
|
||||
{{else}}
|
||||
❌ <b>Deployment FAILED!</b>
|
||||
{{/success}}
|
||||
commands:
|
||||
- apk add --no-cache curl
|
||||
- |
|
||||
# Tentukan Emoji berdasarkan status build
|
||||
if [ "${CI_BUILD_STATUS}" = "success" ]; then
|
||||
ICON="✅"
|
||||
TEXT="SUCCESS"
|
||||
else
|
||||
ICON="❌"
|
||||
TEXT="FAILED"
|
||||
fi
|
||||
|
||||
<b>📦 Project:</b> <code>{{ repo.name }}</code>
|
||||
<b>🌿 Branch:</b> <code>{{ build.branch }}</code>
|
||||
<b>📝 Commit:</b> <i>{{ commit.message }}</i>
|
||||
|
||||
🔗 <a href="{{ build.link }}">Lihat Detail Log</a>
|
||||
# Kirim ke Telegram menggunakan API direct (sama seperti cara manual)
|
||||
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendMessage" \
|
||||
-d "chat_id=${TELEGRAM_CHAT_ID}" \
|
||||
-d "message_thread_id=8" \
|
||||
-d "parse_mode=HTML" \
|
||||
-d "text=${ICON} <b>Deployment ${TEXT}!</b>%0A%0A<b>📦 Project:</b> <code>${CI_REPO_NAME}</code>%0A<b>🌿 Branch:</b> <code>${CI_COMMIT_BRANCH}</code>%0A<b>📝 Commit:</b> <i>${CI_COMMIT_MESSAGE}</i>%0A%0A🔗 <a href='${CI_BUILD_LINK}'>Lihat Detail Log</a>"
|
||||
when:
|
||||
branch: master
|
||||
event: push
|
||||
status: [ success, failure ] # Kunci agar notifikasi tetap terkirim saat error
|
||||
status: [ success, failure ]
|
||||
Reference in New Issue
Block a user