webhooks/github: Be more explicit about unsupported PR events.

This was technically a bug. For events that aren't unsupported
intentionally, the control should fall to the line that raises
UnknownWebhookEventType, and shouldn't be handled by anything else.

The events that are intentionally unsupported should be handled
more explicitly.
This commit is contained in:
Eeshan Garg
2018-07-01 14:59:45 -02:30
committed by Tim Abbott
parent 2673a7f71f
commit 04ed123214
2 changed files with 3 additions and 10 deletions

View File

@@ -389,8 +389,9 @@ def get_event(request: HttpRequest, payload: Dict[str, Any], branches: str) -> O
return 'assigned_or_unassigned_pull_request'
if action == 'closed':
return 'closed_pull_request'
logging.warning(u'Event pull_request with {} action is unsupported'.format(action))
return None
# Unsupported pull_request events
if action in ('labeled', 'unlabeled', 'review_request_removed'):
return None
if event == 'push':
if is_commit_push_event(payload):
if branches is not None: