From 2cd153b2024419e626fcfc4de0a76d750438a6eb Mon Sep 17 00:00:00 2001 From: chenmozhijin <110812055+chenmozhijin@users.noreply.github.com> Date: Fri, 27 Sep 2024 02:35:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A7release=E6=97=B6?= =?UTF-8?q?=E5=90=8C=E6=97=B6=E5=88=A0=E9=99=A4tags?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_helper/utils/repo.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build_helper/utils/repo.py b/build_helper/utils/repo.py index b4dc341f..ba78f918 100644 --- a/build_helper/utils/repo.py +++ b/build_helper/utils/repo.py @@ -101,10 +101,17 @@ def new_release(cfg: dict, assets: list[str], body: str) -> None: release.upload_asset(asset) try: + headers = { + "Accept": "application/vnd.github+json", + "X-GitHub-Api-Version": "2022-11-28", + "Authorization": f'Bearer {token}', + } for release in releases: if release.tag_name.endswith(tag_suffix) and release.tag_name != tag_name: logger.info("删除旧版本: %s", release.tag_name) release.delete_release() + requests.delete(f"https://api.github.com/repos/{user_repo}/git/refs/tags/{release.tag_name}", headers=headers, timeout=10) + except Exception: logger.exception("删除旧版本失败")