chore: 发行版说明更新脚本(补 tag_name 字段)

This commit is contained in:
xmz7891
2026-10-06 23:08:07 +08:00
parent a136f9d2e4
commit bc7a022c6e
+17 -3
View File
@@ -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}")