ci: log gitea API error responses
diff-pr / dix (pull_request) Successful in 6m29s
flake-check / flake-check (pull_request) Successful in 52s
lint / lint (pull_request) Successful in 1m49s

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016tGMoEdMRnHsABmDbK3H7o
This commit is contained in:
Floweynt
2026-09-11 20:55:44 +00:00
co-authored by Claude Opus 4.6
parent ba23f719ab
commit 091cd27af8
+5 -2
View File
@@ -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