add a simple timeout check for sync script (#42)
* add a simple timeout check for sync script * add workflow timeout
This commit is contained in:
parent
0a6adea9ab
commit
d7ca50dd83
1
.github/workflows/sync-release.yml
vendored
1
.github/workflows/sync-release.yml
vendored
@ -6,6 +6,7 @@ on:
|
||||
jobs:
|
||||
sync-release-to-gitee:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
env:
|
||||
GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }}
|
||||
steps:
|
||||
|
12
.github/workflows/sync.py
vendored
12
.github/workflows/sync.py
vendored
@ -53,7 +53,17 @@ def sync_to_gitee(tag: str, body: str, files: slice):
|
||||
'prerelease': False,
|
||||
'target_commitish': 'main'
|
||||
}
|
||||
release_api_response = api_client.post(release_api_uri, json=release_data)
|
||||
while True:
|
||||
try:
|
||||
release_api_response = api_client.post(release_api_uri, json=release_data, timeout=30)
|
||||
release_api_response.raise_for_status()
|
||||
break
|
||||
except requests.exceptions.Timeout as errt:
|
||||
print(f"Request timed out: {errt} Retrying in 60 seconds...")
|
||||
time.sleep(60)
|
||||
except requests.exceptions.RequestException as err:
|
||||
print(f"Request failed: {err}")
|
||||
break
|
||||
if release_api_response.status_code == 201:
|
||||
release_info = release_api_response.json()
|
||||
release_id = release_info.get('id')
|
||||
|
Loading…
x
Reference in New Issue
Block a user