From eff40a4949c3455ecdc01cf97e9afde5b7e6bb0a Mon Sep 17 00:00:00 2001 From: OG T Date: Thu, 16 Apr 2026 13:38:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20=E4=BF=AE=E5=BE=A9=20cd.yaml=20YAML?= =?UTF-8?q?=20=E8=A7=A3=E6=9E=90=E5=A4=B1=E6=95=97=20=E2=80=94=20=E2=94=9C?= =?UTF-8?q?=20=E5=AD=97=E5=85=83=E7=BC=BA=E7=B8=AE=E6=8E=92=E5=B0=8E?= =?UTF-8?q?=E8=87=B4=20CI=20=E5=85=A8=E5=81=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因: 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 --- .gitea/workflows/cd.yaml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) 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"}')"