feat(cd): 改善部署通知格式 (用戶友善)
- 顯示版本描述 (commit message 前50字) - 顯示部署時間 (Asia/Taipei 時區) - 顯示作者 - 顯示簡短 SHA Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
12
.github/workflows/cd.yaml
vendored
12
.github/workflows/cd.yaml
vendored
@@ -257,12 +257,18 @@ jobs:
|
|||||||
- name: Notify Telegram
|
- name: Notify Telegram
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
|
# 取得 commit 資訊
|
||||||
|
COMMIT_MSG=$(git log -1 --pretty=format:'%s' | head -c 50)
|
||||||
|
AUTHOR=$(git log -1 --pretty=format:'%an')
|
||||||
|
DEPLOY_TIME=$(TZ='Asia/Taipei' date '+%Y-%m-%d %H:%M')
|
||||||
|
SHORT_SHA=$(echo "${{ github.sha }}" | head -c 7)
|
||||||
|
|
||||||
if [ "${{ job.status }}" = "success" ]; then
|
if [ "${{ job.status }}" = "success" ]; then
|
||||||
MSG="✅ *AWOOOI 部署成功*"
|
MSG="✅ *AWOOOI 部署成功*%0A%0A📦 版本: ${COMMIT_MSG}%0A⏰ 時間: ${DEPLOY_TIME}%0A👤 作者: ${AUTHOR}%0A🔖 SHA: ${SHORT_SHA}%0A%0A🔗 [查看 Workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})"
|
||||||
else
|
else
|
||||||
MSG="❌ *AWOOOI 部署失敗*"
|
MSG="❌ *AWOOOI 部署失敗*%0A%0A📦 版本: ${COMMIT_MSG}%0A⏰ 時間: ${DEPLOY_TIME}%0A👤 作者: ${AUTHOR}%0A🔖 SHA: ${SHORT_SHA}%0A%0A🔗 [查看 Workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})"
|
||||||
fi
|
fi
|
||||||
curl -sf -X POST "https://api.telegram.org/bot${{ secrets.OPENCLAW_TG_BOT_TOKEN }}/sendMessage" \
|
curl -sf -X POST "https://api.telegram.org/bot${{ secrets.OPENCLAW_TG_BOT_TOKEN }}/sendMessage" \
|
||||||
-d chat_id="${{ secrets.OPENCLAW_TG_CHAT_ID }}" \
|
-d chat_id="${{ secrets.OPENCLAW_TG_CHAT_ID }}" \
|
||||||
-d text="${MSG}%0ACommit: \`${{ github.sha }}\`%0A🔗 [Workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" \
|
-d text="${MSG}" \
|
||||||
-d parse_mode="Markdown" || true
|
-d parse_mode="Markdown" || true
|
||||||
|
|||||||
Reference in New Issue
Block a user