fix: simplify Telegram notification format
This commit is contained in:
26
.github/workflows/deploy-prod.yml
vendored
26
.github/workflows/deploy-prod.yml
vendored
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user