Skip to content

Commit

Permalink
feat: make it simple
Browse files Browse the repository at this point in the history
  • Loading branch information
paolomainardi committed Aug 22, 2024
1 parent a5bb130 commit 055c4cd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pr_agent/servers/gitlab_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,13 @@ async def inner(data: dict):
return JSONResponse(status_code=status.HTTP_200_OK, content=jsonable_encoder({"message": "success"}))

log_context["sender"] = sender
should_skip_draft = get_settings().get("GITLAB.SKIP_DRAFT_MR", False)
if data.get('object_kind') == 'merge_request' and data['object_attributes'].get('action') in ['open', 'reopen']:
url = data['object_attributes'].get('url')
draft = data['object_attributes'].get('draft')
get_logger().info(f"New merge request: {url}")

if draft:
if draft and should_skip_draft:
get_logger().info(f"Skipping draft MR: {url}")
return JSONResponse(status_code=status.HTTP_200_OK, content=jsonable_encoder({"message": "success"}))

Expand All @@ -139,7 +140,7 @@ async def inner(data: dict):
mr = data['merge_request']
url = mr.get('url')
draft = mr.get('draft')
if draft:
if draft and should_skip_draft:
get_logger().info(f"Skipping draft MR: {url}")
return JSONResponse(status_code=status.HTTP_200_OK, content=jsonable_encoder({"message": "success"}))

Expand Down

0 comments on commit 055c4cd

Please sign in to comment.