From 23af1afa03c631c8f258e185a7439e3b722cd21f Mon Sep 17 00:00:00 2001 From: Paolo Mainardi Date: Fri, 30 Aug 2024 17:01:18 +0200 Subject: [PATCH] feat: gitlab skip source, target and labels --- pr_agent/servers/gitlab_webhook.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pr_agent/servers/gitlab_webhook.py b/pr_agent/servers/gitlab_webhook.py index 19fec682..3d72bc26 100644 --- a/pr_agent/servers/gitlab_webhook.py +++ b/pr_agent/servers/gitlab_webhook.py @@ -132,10 +132,9 @@ async def gitlab_webhook(background_tasks: BackgroundTasks, request: Request): draft = data['object_attributes'].get('draft') source_branch = data['object_attributes'].get('source_branch') target_branch = data['object_attributes'].get('target_branch') - labels = data['object_attributes'].get('labels').map(lambda x: x['title']) + labels = [label['title'] for label in data['object_attributes'].get('labels', [])] get_logger().info(f"New merge request: {url}") - if target_branch in excluded_target_branches or source_branch in excluded_source_branches: get_logger().info(f"Skipping excluded branch MR: {url}") return JSONResponse(status_code=status.HTTP_200_OK, content=jsonable_encoder({"message": "success"}))