mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 10:10:43 +00:00
chore: 发行版说明更新脚本(补 tag_name 字段)
This commit is contained in:
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user