diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 90c4b5b3..b564d166 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -257,12 +257,18 @@ jobs: - name: Notify Telegram if: always() 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 - 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 - 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 curl -sf -X POST "https://api.telegram.org/bot${{ secrets.OPENCLAW_TG_BOT_TOKEN }}/sendMessage" \ -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