diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index a8320e50..8559a226 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -162,8 +162,9 @@ jobs: CHANGELOG_TRUNCATED="${CHANGELOG_TRUNCATED}..." fi - # 构建消息 - MESSAGE="🚀 *Claude Relay Service 新版本发布!* + # 构建消息,使用 JSON 格式避免转义问题 + MESSAGE=$(cat <<-ENDMSG +🚀 *Claude Relay Service 新版本发布!* 📦 版本号: \`${VERSION}\` @@ -181,16 +182,22 @@ docker pull weishaw/claude-relay-service:latest • [完整更新日志](https://github.com/${REPO}/blob/main/CHANGELOG.md) • [Docker Hub](https://hub.docker.com/r/weishaw/claude-relay-service) -#ClaudeRelay #Update #v${VERSION//./_}" +#ClaudeRelay #Update #v${VERSION//./_} +ENDMSG + ) + + # 准备 JSON 数据 + JSON_DATA=$(jq -n \ + --arg chat_id "${TELEGRAM_CHAT_ID}" \ + --arg text "${MESSAGE}" \ + '{ + chat_id: $chat_id, + text: $text, + parse_mode: "Markdown", + disable_web_page_preview: false + }') # 发送消息到 Telegram curl -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \ -H "Content-Type: application/json" \ - -d @- << EOF - { - "chat_id": "${TELEGRAM_CHAT_ID}", - "text": "${MESSAGE}", - "parse_mode": "Markdown", - "disable_web_page_preview": false - } - EOF \ No newline at end of file + -d "${JSON_DATA}" \ No newline at end of file