integrations: Ignore merge queue push events for GitHub Integration.

Previosuly, the server would send a 500 whenever a merge queue push
event was encountered.

Fixes #25629.
This commit is contained in:
Satyam Bansal
2023-05-23 09:22:42 +05:30
committed by Tim Abbott
parent 3e2d5b3c86
commit cae02dbca4
3 changed files with 156 additions and 0 deletions

View File

@@ -639,6 +639,10 @@ def is_commit_push_event(payload: WildValue) -> bool:
return bool(re.match(r"^refs/heads/", payload["ref"].tame(check_string)))
def is_merge_queue_push_event(payload: WildValue) -> bool:
return bool(re.match(r"^refs/heads/gh-readonly-queue/", payload["ref"].tame(check_string)))
def get_subject_based_on_type(payload: WildValue, event: str) -> str:
if "pull_request" in event:
return TOPIC_WITH_PR_OR_ISSUE_INFO_TEMPLATE.format(
@@ -733,6 +737,7 @@ IGNORED_EVENTS = [
"milestone",
"organization",
"project_card",
"push__merge_queue",
"repository_vulnerability_alert",
]
@@ -827,6 +832,8 @@ def get_zulip_event_name(
if action in IGNORED_PULL_REQUEST_ACTIONS:
return None
elif header_event == "push":
if is_merge_queue_push_event(payload):
return None
if is_commit_push_event(payload):
if branches is not None:
branch = get_branch_name_from_ref(payload["ref"].tame(check_string))