fix(ci): 修復 cd.yaml YAML 解析失敗 — ├ 字元缺縮排導致 CI 全停
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 23m35s

根因: commit 5ee76dc 引入 HTML 結構化格式時,MSG 多行字串的
      ├/└ 行縮排為 0,YAML block scalar 解析失敗
      (yaml: line 72: could not find expected ':')

影響: 2026-04-16 03:27 後所有 commit 均無法觸發 CI build
      包含: cd1c0ff (5-tuple 修復) + 9ea1f77 (ghost button) + 8582439 (KB fix)

修復: 兩處 MSG 改用 printf 單行格式,消除多行 YAML 縮排陷阱

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-04-16 13:38:23 +08:00
parent 8582439d2d
commit eff40a4949

View File

@@ -68,10 +68,7 @@ jobs:
ACTOR="${{ github.actor }}"
# HTML escape commit message防特殊字元破壞 HTML
COMMIT_ESC=$(echo "$COMMIT_MSG" | sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g')
MSG="🚀 <b>AWOOOI 部署開始</b>
├ 📝 <code>${COMMIT_ESC}</code>
├ 🔖 <code>${SHORT_SHA}</code>
└ 👤 ${ACTOR}"
MSG=$(printf '🚀 <b>AWOOOI 部署開始</b>\n├ 📝 <code>%s</code>\n├ 🔖 <code>%s</code>\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/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g')
MSG="❌ <b>AWOOOI 部署失敗</b>
├ 📝 <code>${COMMIT_ESC}</code>
├ 🔖 <code>${SHORT_SHA}</code>
├ 👤 ${ACTOR}
└ 🔗 http://192.168.0.110:3001/wooo/awoooi/actions"
MSG=$(printf '❌ <b>AWOOOI 部署失敗</b>\n├ 📝 <code>%s</code>\n├ 🔖 <code>%s</code>\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"}')"