integration: Split 'opened_or_update_pull_request' event type.

Modified the 'get_zulip_event_name' function to
differentiate between 'opened' and 'updated' actions
for pull requests within the 'pull_request' event type.
Created separate event types for 'opened_pull_request' and
'updated_pull_request'. Updated the 'EVENT_FUNCTION_MAPPER'
dictionary to include handlers for these new event types.
Adjusted the'get_opened_or_update_pull_request_body' function to handle
both 'opened' and 'updated' actions appropriately.

Fixes #29594.
This commit is contained in:
sujal shah 2024-04-06 17:29:42 +05:30 committed by Tim Abbott
parent 7291f0a919
commit dd91157993
1 changed files with 6 additions and 3 deletions

View File

@ -829,7 +829,8 @@ EVENT_FUNCTION_MAPPER: Dict[str, Callable[[Helper], str]] = {
"issues": get_issue_body,
"member": get_member_body,
"membership": get_membership_body,
"opened_or_update_pull_request": get_opened_or_update_pull_request_body,
"opened_pull_request": get_opened_or_update_pull_request_body,
"updated_pull_request": get_opened_or_update_pull_request_body,
"assigned_or_unassigned_pull_request": get_assigned_or_unassigned_pull_request_body,
"page_build": get_page_build_body,
"ping": get_ping_body,
@ -951,8 +952,10 @@ def get_zulip_event_name(
"""
if header_event == "pull_request":
action = payload["action"].tame(check_string)
if action in ("opened", "synchronize", "reopened", "edited"):
return "opened_or_update_pull_request"
if action in ("opened", "reopened"):
return "opened_pull_request"
elif action in ("synchronize", "edited"):
return "updated_pull_request"
if action in ("assigned", "unassigned"):
return "assigned_or_unassigned_pull_request"
if action == "closed":