From c6a36ab6733cf97e9e201fff82909d9addd61d9e Mon Sep 17 00:00:00 2001 From: OG T Date: Sun, 22 Mar 2026 19:04:50 +0800 Subject: [PATCH] fix: simplify Telegram notification format --- .github/workflows/deploy-prod.yml | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index 2c08b614a..57b35c029 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -265,24 +265,14 @@ jobs: env: TELEGRAM_TOKEN: ${{ secrets.OPENCLAW_TG_BOT_TOKEN }} TELEGRAM_CHAT_ID: ${{ secrets.OPENCLAW_TG_CHAT_ID }} - GH_SHA: ${{ github.sha }} - GH_SERVER: ${{ github.server_url }} - GH_REPO: ${{ github.repository }} - GH_ACTOR: ${{ github.actor }} - GH_RUN_ID: ${{ github.run_id }} - run: |- - EMOJI="${{ steps.status.outputs.emoji }}" - MSG="${{ steps.status.outputs.message }}" - TAG="${{ needs.build.outputs.image_tag }}" - COMMIT_MSG=$(git log -1 --pretty=%B 2>/dev/null | head -1 || echo "N/A") - TEXT=$(printf "%s *AWOOOI %s*\n\nTag: %s\nCommit: %s\nMsg: %s\nActor: %s\nEnv: Production (K3s 120)\n\nDetails: %s/%s/actions/runs/%s" \ - "$EMOJI" "$MSG" "$TAG" "${GH_SHA:0:7}" "$COMMIT_MSG" "$GH_ACTOR" "$GH_SERVER" "$GH_REPO" "$GH_RUN_ID") - if [ -n "$TELEGRAM_TOKEN" ] && [ -n "$TELEGRAM_CHAT_ID" ]; then - jq -n --arg text "$TEXT" --arg chat "$TELEGRAM_CHAT_ID" '{chat_id: $chat, text: $text, disable_web_page_preview: true}' | \ - curl -sf -X POST "https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendMessage" -H "Content-Type: application/json" -d @- && echo "Telegram sent" || echo "Telegram failed" - else - echo "Telegram secrets not configured" - fi + BUILD_TAG: ${{ needs.build.outputs.image_tag }} + BUILD_STATUS: ${{ steps.status.outputs.message }} + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + run: | + STATUS="${{ steps.status.outputs.status }}" + if [ "$STATUS" = "success" ]; then EMOJI="✅"; else EMOJI="❌"; fi + MSG="${EMOJI} AWOOOI ${BUILD_STATUS} | Tag: ${BUILD_TAG} | Actor: ${{ github.actor }} | ${RUN_URL}" + curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendMessage" -d chat_id="${TELEGRAM_CHAT_ID}" -d text="${MSG}" - name: Send OpenClaw Webhook if: always()