From bc7a022c6e8eaf64d69d319ae29bfc99c6c9ced5 Mon Sep 17 00:00:00 2001 From: xmz7891 Date: Tue, 6 Oct 2026 22:50:53 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=8F=91=E8=A1=8C=E7=89=88=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E6=9B=B4=E6=96=B0=E8=84=9A=E6=9C=AC=EF=BC=88=E8=A1=A5?= =?UTF-8?q?=20tag=5Fname=20=E5=AD=97=E6=AE=B5=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _build/update_release_notes.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/_build/update_release_notes.py b/_build/update_release_notes.py index 435711a..5a3d9fa 100644 --- a/_build/update_release_notes.py +++ b/_build/update_release_notes.py @@ -4,6 +4,7 @@ from __future__ import annotations import json import sys +import urllib.error import urllib.request from pathlib import Path @@ -44,9 +45,22 @@ def main() -> int: print(" [失败] 没拿到 id") return 1 - updated = call(f"{API}/releases/{rid}", - {"access_token": TOKEN, "name": f"ykxmz {TAG.lstrip(chr(118))}", - "body": body, "prerelease": False}, method="PATCH") + # Gitee 的 PATCH 需要 tag_name + target_commitish,光给 body 会 400 + payload = { + "access_token": TOKEN, + "tag_name": TAG, + "name": f"ykxmz {TAG.lstrip(chr(118))}", + "body": body, + "prerelease": False, + "target_commitish": "main", + } + try: + updated = call(f"{API}/releases/{rid}", payload, method="PATCH") + except urllib.error.HTTPError as exc: + detail = exc.read().decode("utf-8", "replace")[:300] + print(f" PATCH 失败 HTTP {exc.code}: {detail}") + print(" 改用 PUT 再试…") + updated = call(f"{API}/releases/{rid}", payload, method="PUT") print("\n 更新后的说明:") for line in (updated.get("body") or "").splitlines(): print(f" {line}")