ci: log gitea API error responses
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016tGMoEdMRnHsABmDbK3H7o
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
ba23f719ab
commit
091cd27af8
@@ -33,8 +33,11 @@ def gitea(method, path, body=None):
|
||||
req.add_header("Authorization", f'token {os.environ["GH_TOKEN"]}')
|
||||
if data is not None:
|
||||
req.add_header("Content-Type", "application/json")
|
||||
with urllib.request.urlopen(req) as resp:
|
||||
raw = resp.read()
|
||||
try:
|
||||
with urllib.request.urlopen(req) as resp:
|
||||
raw = resp.read()
|
||||
except urllib.error.HTTPError as e:
|
||||
sys.exit(f"gitea {method} {path}: {e.code} {e.reason}\n{e.read().decode()}")
|
||||
return json.loads(raw) if raw else None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user