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
|
branch: master
|
||||||
event: push
|
event: push
|
||||||
|
|
||||||
# 3. Notification (Jalan saat sukses maupun gagal)
|
# 3. Notification (Menggunakan cURL untuk memastikan masuk Topik 8)
|
||||||
notify-telegram:
|
notify-telegram:
|
||||||
image: appleboy/drone-telegram
|
image: alpine
|
||||||
settings:
|
environment:
|
||||||
token:
|
TELEGRAM_TOKEN:
|
||||||
from_secret: telegram_token
|
from_secret: telegram_token
|
||||||
to:
|
TELEGRAM_CHAT_ID:
|
||||||
from_secret: telegram_chat_id
|
from_secret: telegram_chat_id
|
||||||
message_thread_id: 8
|
commands:
|
||||||
format: html
|
- apk add --no-cache curl
|
||||||
message: |
|
- |
|
||||||
{{#success build.status}}
|
# Tentukan Emoji berdasarkan status build
|
||||||
✅ <b>Deployment SUCCESS!</b>
|
if [ "${CI_BUILD_STATUS}" = "success" ]; then
|
||||||
{{else}}
|
ICON="✅"
|
||||||
❌ <b>Deployment FAILED!</b>
|
TEXT="SUCCESS"
|
||||||
{{/success}}
|
else
|
||||||
|
ICON="❌"
|
||||||
<b>📦 Project:</b> <code>{{ repo.name }}</code>
|
TEXT="FAILED"
|
||||||
<b>🌿 Branch:</b> <code>{{ build.branch }}</code>
|
fi
|
||||||
<b>📝 Commit:</b> <i>{{ commit.message }}</i>
|
|
||||||
|
# Kirim ke Telegram menggunakan API direct (sama seperti cara manual)
|
||||||
🔗 <a href="{{ build.link }}">Lihat Detail Log</a>
|
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:
|
when:
|
||||||
branch: master
|
branch: master
|
||||||
event: push
|
event: push
|
||||||
status: [ success, failure ] # Kunci agar notifikasi tetap terkirim saat error
|
status: [ success, failure ]
|
||||||
Reference in New Issue
Block a user