fix(lint): use httpx.AsyncClient instead of sync requests
CI / lint (pull_request) Successful in 7s
CI / test (pull_request) Successful in 8s
CI / notify-on-failure (pull_request) Successful in 0s

This commit is contained in:
cfdaily
2026-06-10 08:23:19 +08:00
parent c4f615ce7f
commit cb0b35a689
+6 -6
View File
@@ -464,12 +464,12 @@ async def _handle_issue_comment(payload: Dict[str, Any]) -> None:
sha_match = re.search(r"commit:\s*`?([0-9a-f]{40})`?", body)
if sha_match:
try:
resp = requests.get(
f"{_GITEA_BASE}/commits/{sha_match.group(1)}/status",
headers={"Authorization": f"token {_GITEA_TOKEN}"},
timeout=5,
)
if resp.ok:
async with httpx.AsyncClient(timeout=5.0) as client:
resp = await client.get(
f"{_GITEA_BASE}/commits/{sha_match.group(1)}/status",
headers={"Authorization": f"token {_GITEA_TOKEN}"},
)
if resp.status_code == 200:
statuses = resp.json().get("statuses", [])
for s in statuses:
if s.get("status") == "failure" or s.get("state") == "failure":