From 45676fdc8da710b7c046cf4669ad1f4be5cb4f59 Mon Sep 17 00:00:00 2001 From: shaw Date: Mon, 26 Jan 2026 11:04:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20=E8=BD=AC=E4=B9=89=20Telegram=20?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E4=B8=AD=E7=9A=84=20Markdown=20=E7=89=B9?= =?UTF-8?q?=E6=AE=8A=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复发布通知发送失败的问题,原因是 tag message 中包含未闭合的 Markdown 格式标记(如 user_id 中的 _ 被解析为斜体开始)导致 Telegram API 返回解析错误。 添加 sed 命令转义 _、*、` 和 [ 字符,避免被 Telegram Markdown 解析器错误处理。 --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 73ca35d9..0415000d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -222,8 +222,9 @@ jobs: REPO="${{ github.repository }}" GHCR_IMAGE="ghcr.io/${REPO,,}" # ${,,} converts to lowercase - # 获取 tag message 内容 + # 获取 tag message 内容并转义 Markdown 特殊字符 TAG_MESSAGE='${{ steps.tag_message.outputs.message }}' + TAG_MESSAGE=$(echo "$TAG_MESSAGE" | sed 's/\([_*`\[]\)/\\\1/g') # 限制消息长度(Telegram 消息限制 4096 字符,预留空间给头尾固定内容) if [ ${#TAG_MESSAGE} -gt 3500 ]; then