@@ -198,9 +198,9 @@ async def inner(data: dict):
198
198
# ignore MRs based on title, labels, source and target branches
199
199
if not should_process_pr_logic (data ):
200
200
return JSONResponse (status_code = status .HTTP_200_OK , content = jsonable_encoder ({"message" : "success" }))
201
-
202
- if data [ ' object_attributes' ] .get ('action' ) in ['open' , 'reopen' ]:
203
- url = data [ ' object_attributes' ] .get ('url' )
201
+ object_attributes = data . get ( 'object_attributes' , {})
202
+ if object_attributes .get ('action' ) in ['open' , 'reopen' ]:
203
+ url = object_attributes .get ('url' )
204
204
get_logger ().info (f"New merge request: { url } " )
205
205
if is_draft (data ):
206
206
get_logger ().info (f"Skipping draft MR: { url } " )
@@ -209,8 +209,8 @@ async def inner(data: dict):
209
209
await _perform_commands_gitlab ("pr_commands" , PRAgent (), url , log_context , data )
210
210
211
211
# for push event triggered merge requests
212
- elif data [ ' object_attributes' ] .get ('action' ) == 'update' and data [ ' object_attributes' ] .get ('oldrev' ):
213
- url = data [ ' object_attributes' ] .get ('url' )
212
+ elif object_attributes .get ('action' ) == 'update' and object_attributes .get ('oldrev' ):
213
+ url = object_attributes .get ('url' )
214
214
get_logger ().info (f"New merge request: { url } " )
215
215
if is_draft (data ):
216
216
get_logger ().info (f"Skipping draft MR: { url } " )
@@ -227,8 +227,8 @@ async def inner(data: dict):
227
227
await _perform_commands_gitlab ("push_commands" , PRAgent (), url , log_context , data )
228
228
229
229
# for draft to ready triggered merge requests
230
- elif data [ ' object_attributes' ] .get ('action' ) == 'update' and is_draft_ready (data ):
231
- url = data [ ' object_attributes' ] .get ('url' )
230
+ elif object_attributes .get ('action' ) == 'update' and is_draft_ready (data ):
231
+ url = object_attributes .get ('url' )
232
232
get_logger ().info (f"Draft MR is ready: { url } " )
233
233
234
234
# same as open MR
0 commit comments