diff --git a/.gitea/workflows/cd.yaml b/.gitea/workflows/cd.yaml index ab8cef78..5a252554 100644 --- a/.gitea/workflows/cd.yaml +++ b/.gitea/workflows/cd.yaml @@ -63,11 +63,10 @@ jobs: - name: Notify Pipeline Start run: | MSG="AWOOOI Deploy Start | ${{ steps.commit.outputs.message }} | ${{ steps.commit.outputs.short_sha }} | ${{ github.actor }}" - # 2026-04-12 ogt: 棄用 python3 JSON 序列化(中文 commit message 在 runner 內 UTF-8 解碼失敗) - # 改用 --data-urlencode,與 Notify Pipeline Success 一致 - printf '%s' "$MSG" | curl -fS -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \ - -d "chat_id=${{ secrets.TELEGRAM_CHAT_ID }}" \ - --data-urlencode "text@-" + # 2026-04-12 ogt: 用 jq 建 JSON,正確處理中文 commit message(python3 stdin 與 data-urlencode 均失敗) + 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}')" @@ -568,7 +567,7 @@ jobs: if: failure() run: | MSG="AWOOOI Deploy FAILED | ${{ steps.commit.outputs.message }} | ${{ steps.commit.outputs.short_sha }} | ${{ github.actor }} | http://192.168.0.110:3001/wooo/awoooi/actions" - # 2026-04-12 ogt: 同 Notify Pipeline Start — 棄用 python3,改用 --data-urlencode - printf '%s' "$MSG" | curl -fS -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \ - -d "chat_id=${{ secrets.TELEGRAM_CHAT_ID }}" \ - --data-urlencode "text@-" + # 2026-04-12 ogt: 同 Notify Pipeline Start — 用 jq 建 JSON + 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}')"