diff --git a/.gitea/workflows/cd.yaml b/.gitea/workflows/cd.yaml index 93d8aa78..cb8e1605 100644 --- a/.gitea/workflows/cd.yaml +++ b/.gitea/workflows/cd.yaml @@ -68,10 +68,7 @@ jobs: ACTOR="${{ github.actor }}" # HTML escape commit message(防特殊字元破壞 HTML) COMMIT_ESC=$(echo "$COMMIT_MSG" | sed 's/&/\&/g; s//\>/g') - MSG="🚀 AWOOOI 部署開始 -├ 📝 ${COMMIT_ESC} -├ 🔖 ${SHORT_SHA} -└ 👤 ${ACTOR}" + MSG=$(printf '🚀 AWOOOI 部署開始\n├ 📝 %s\n├ 🔖 %s\n└ 👤 %s' "${COMMIT_ESC}" "${SHORT_SHA}" "${ACTOR}") curl -fS -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \ -H "Content-Type: application/json" \ -d "$(jq -n --arg c "${{ secrets.TELEGRAM_CHAT_ID }}" --arg t "$MSG" '{chat_id:$c,text:$t,parse_mode:"HTML"}')" @@ -580,11 +577,7 @@ jobs: SHORT_SHA="${{ steps.commit.outputs.short_sha }}" ACTOR="${{ github.actor }}" COMMIT_ESC=$(echo "$COMMIT_MSG" | sed 's/&/\&/g; s//\>/g') - MSG="❌ AWOOOI 部署失敗 -├ 📝 ${COMMIT_ESC} -├ 🔖 ${SHORT_SHA} -├ 👤 ${ACTOR} -└ 🔗 http://192.168.0.110:3001/wooo/awoooi/actions" + MSG=$(printf '❌ AWOOOI 部署失敗\n├ 📝 %s\n├ 🔖 %s\n├ 👤 %s\n└ 🔗 http://192.168.0.110:3001/wooo/awoooi/actions' "${COMMIT_ESC}" "${SHORT_SHA}" "${ACTOR}") curl -fS -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \ -H "Content-Type: application/json" \ -d "$(jq -n --arg c "${{ secrets.TELEGRAM_CHAT_ID }}" --arg t "$MSG" '{chat_id:$c,text:$t,parse_mode:"HTML"}')"