Merge pull request 'fix: auto repair bugs #55' (#3) from fix/auto-20260228-144441 into main
All checks were successful
Build and Deploy Log Center / build-and-deploy (push) Successful in 5m5s
All checks were successful
Build and Deploy Log Center / build-and-deploy (push) Successful in 5m5s
Merge PR #3 (approved via Log Center)
This commit is contained in:
commit
708021c443
@ -60,10 +60,11 @@ class GiteaClient:
|
||||
response.raise_for_status()
|
||||
return True, "PR 合并成功"
|
||||
except httpx.HTTPStatusError as e:
|
||||
error_msg = f"HTTP {e.response.status_code}"
|
||||
if e.response.status_code == 405:
|
||||
error_msg += ": PR 已经合并或已关闭"
|
||||
elif e.response.status_code == 409:
|
||||
# PR 已经被合并或关闭,视为成功(期望的结果已达成)
|
||||
return True, "PR 已经被合并或关闭"
|
||||
error_msg = f"HTTP {e.response.status_code}"
|
||||
if e.response.status_code == 409:
|
||||
error_msg += ": 存在合并冲突"
|
||||
elif e.response.status_code == 403:
|
||||
error_msg += ": Token 权限不足"
|
||||
|
||||
@ -354,7 +354,7 @@ async def approve_report(report_id: int, session: AsyncSession = Depends(get_ses
|
||||
gitea_client = GiteaClient()
|
||||
success, message = gitea_client.merge_pr_by_url(report.pr_url)
|
||||
if not success:
|
||||
raise HTTPException(status_code=500, detail=f"合并 PR 失败: {message}")
|
||||
raise HTTPException(status_code=502, detail=f"合并 PR 失败: {message}")
|
||||
|
||||
# 更新报告状态
|
||||
report.status = LogStatus.FIXED
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user