From 76cb281c96d0aae346fb049626b6123460384e74 Mon Sep 17 00:00:00 2001 From: Moh Dzulfikri Maulana <106526316+Dzuuul@users.noreply.github.com> Date: Tue, 10 Mar 2026 14:16:56 +0700 Subject: [PATCH] build: replace Telegram notification plugin with a custom curl command. --- .woodpecker.yml | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index b725b77..f3f7551 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -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}} - ✅ Deployment SUCCESS! - {{else}} - ❌ Deployment FAILED! - {{/success}} - - 📦 Project: {{ repo.name }} - 🌿 Branch: {{ build.branch }} - 📝 Commit: {{ commit.message }} - - 🔗 Lihat Detail Log + 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 + + # 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} Deployment ${TEXT}!%0A%0A📦 Project: ${CI_REPO_NAME}%0A🌿 Branch: ${CI_COMMIT_BRANCH}%0A📝 Commit: ${CI_COMMIT_MESSAGE}%0A%0A🔗 Lihat Detail Log" when: branch: master event: push - status: [ success, failure ] # Kunci agar notifikasi tetap terkirim saat error \ No newline at end of file + status: [ success, failure ] \ No newline at end of file