diff --git a/.github/sync.py b/.github/sync.py index 07292d6..9d45183 100644 --- a/.github/sync.py +++ b/.github/sync.py @@ -52,10 +52,7 @@ def delete_gitee_releases(latest_id, client, uri, token): print(f'Current release ids: {release_ids}') release_ids.remove(latest_id) - # 2024.12.01 保留 v0 开头的 Release for id in release_ids: - if id.startswith('v0'): - continue release_uri = f"{uri}/{id}" delete_data = { 'access_token': token @@ -97,12 +94,6 @@ def sync_to_gitee(tag: str, body: str, files: slice): f"Request failed with status code {release_api_response.status_code}") print(f"Gitee release id: {release_id}") - - # 仅保留最新 Release 以防超出 Gitee 仓库配额 - try: - delete_gitee_releases(release_id, api_client, - release_api_uri, access_token) - asset_api_uri = f"{release_api_uri}/{release_id}/attach_files" for file_path in files: @@ -125,6 +116,9 @@ def sync_to_gitee(tag: str, body: str, files: slice): print( f"Request failed with status code {asset_api_response.status_code}") + # 仅保留最新 Release 以防超出 Gitee 仓库配额 + try: + delete_gitee_releases(release_id, api_client, release_api_uri, access_token) except ValueError as e: print(e)