feat: keep manual comments working when commenting draft MRs

closes #1160
This commit is contained in:
Paolo Mainardi
2024-08-26 14:50:43 +02:00
committed by GitHub
parent 6a5ff2fa3b
commit c9ed271eaf

View File

@ -138,11 +138,7 @@ async def gitlab_webhook(background_tasks: BackgroundTasks, request: Request):
if 'merge_request' in data:
mr = data['merge_request']
url = mr.get('url')
draft = mr.get('draft')
if draft:
get_logger().info(f"Skipping draft MR: {url}")
return JSONResponse(status_code=status.HTTP_200_OK, content=jsonable_encoder({"message": "success"}))
get_logger().info(f"A comment has been added to a merge request: {url}")
body = data.get('object_attributes', {}).get('note')
if data.get('object_attributes', {}).get('type') == 'DiffNote' and '/ask' in body: # /ask_line