Fix github trigger when submitting a webhook without a head_commit

Fixes #2125
This commit is contained in:
Joseph Schorr 2016-11-16 14:14:13 -05:00
parent 1346b7fb63
commit 69e2cfad70
3 changed files with 136 additions and 1 deletions

View file

@ -29,7 +29,7 @@ GITHUB_WEBHOOK_PAYLOAD_SCHEMA = {
'type': 'string',
},
'head_commit': {
'type': 'object',
'type': ['object', 'null'],
'properties': {
'id': {
'type': 'string',
@ -98,6 +98,9 @@ def get_transformed_webhook_payload(gh_payload, default_branch=None, lookup_user
payload = JSONPathDict(gh_payload)
if payload['head_commit'] is None:
raise SkipRequestException
config = SafeDictSetter()
config['commit'] = payload['head_commit.id']
config['ref'] = payload['ref']