mirror of
https://github.com/zulip/zulip.git
synced 2025-11-21 23:19:10 +00:00
github webhook: Ignore more pull_request actions.
See https://github.com/zulip/zulip/issues/16258 for possible follow up here. We now ignore the following two new pull_request actions (as well as the three existing ones from before): approved converted_to_draft As the issue above indicates, we may want to actually support "approved" if we can find somebody to work on the webhook. (And then the issue goes a little broader than what changed here.)
This commit is contained in:
@@ -358,6 +358,8 @@ A temporary team so that I can get some webhook fixtures!
|
|||||||
|
|
||||||
def test_ignored_pull_request_actions(self) -> None:
|
def test_ignored_pull_request_actions(self) -> None:
|
||||||
ignored_actions = [
|
ignored_actions = [
|
||||||
|
"approved",
|
||||||
|
"converted_to_draft",
|
||||||
"labeled",
|
"labeled",
|
||||||
"review_request_removed",
|
"review_request_removed",
|
||||||
"unlabeled",
|
"unlabeled",
|
||||||
|
|||||||
@@ -526,6 +526,14 @@ IGNORED_EVENTS = [
|
|||||||
"repository_vulnerability_alert",
|
"repository_vulnerability_alert",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
IGNORED_PULL_REQUEST_ACTIONS = [
|
||||||
|
"approved",
|
||||||
|
"converted_to_draft",
|
||||||
|
"labeled",
|
||||||
|
"review_request_removed",
|
||||||
|
"unlabeled",
|
||||||
|
]
|
||||||
|
|
||||||
@api_key_only_webhook_view('GitHub', notify_bot_owner_on_invalid_json=True)
|
@api_key_only_webhook_view('GitHub', notify_bot_owner_on_invalid_json=True)
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_github_webhook(
|
def api_github_webhook(
|
||||||
@@ -561,8 +569,7 @@ def get_event(request: HttpRequest, payload: Dict[str, Any], branches: Optional[
|
|||||||
return f'{event}_{action}'
|
return f'{event}_{action}'
|
||||||
if action == 'ready_for_review':
|
if action == 'ready_for_review':
|
||||||
return 'pull_request_ready_for_review'
|
return 'pull_request_ready_for_review'
|
||||||
# Unsupported pull_request events
|
if action in IGNORED_PULL_REQUEST_ACTIONS:
|
||||||
if action in ('labeled', 'unlabeled', 'review_request_removed'):
|
|
||||||
return None
|
return None
|
||||||
elif event == 'push':
|
elif event == 'push':
|
||||||
if is_commit_push_event(payload):
|
if is_commit_push_event(payload):
|
||||||
|
|||||||
Reference in New Issue
Block a user