mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-05 21:30:40 +08:00
Update azuredevops_server_webhook.py
fix returned HTTP status
This commit is contained in:
@ -69,7 +69,7 @@ async def handle_webhook(background_tasks: BackgroundTasks, request: Request):
|
|||||||
if get_settings().get("github_action_config").get("auto_describe") == True:
|
if get_settings().get("github_action_config").get("auto_describe") == True:
|
||||||
actions.append("describe")
|
actions.append("describe")
|
||||||
|
|
||||||
elif data["eventType"] == "ms.vss-code.git-pullrequest-comment-event":
|
elif data["eventType"] == "ms.vss-code.git-pullrequest-comment-event" and "content" in data["resource"]["comment"]:
|
||||||
if available_commands_rgx.match(data["resource"]["comment"]["content"]):
|
if available_commands_rgx.match(data["resource"]["comment"]["content"]):
|
||||||
if(data["resourceVersion"] == "2.0"):
|
if(data["resourceVersion"] == "2.0"):
|
||||||
repo = data["resource"]["pullRequest"]["repository"]["webUrl"]
|
repo = data["resource"]["pullRequest"]["repository"]["webUrl"]
|
||||||
@ -87,7 +87,7 @@ async def handle_webhook(background_tasks: BackgroundTasks, request: Request):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
status_code=status.HTTP_400_BAD_REQUEST,
|
status_code=status.HTTP_204_NO_CONTENT,
|
||||||
content=json.dumps({"message": "Unsupported event"}),
|
content=json.dumps({"message": "Unsupported event"}),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ async def handle_webhook(background_tasks: BackgroundTasks, request: Request):
|
|||||||
content=json.dumps({"message": "Internal server error"}),
|
content=json.dumps({"message": "Internal server error"}),
|
||||||
)
|
)
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
status_code=status.HTTP_200_OK, content=jsonable_encoder({"message": "webhook triggerd successfully"})
|
status_code=status.HTTP_202_ACCEPTED, content=jsonable_encoder({"message": "webhook triggerd successfully"})
|
||||||
)
|
)
|
||||||
|
|
||||||
@router.get("/")
|
@router.get("/")
|
||||||
|
Reference in New Issue
Block a user