From d73abda5d1b50fd0b321a37126ad94e389754fea Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Tue, 10 Sep 2019 17:27:32 -0400 Subject: [PATCH] Update the webhook receiver git ref extractor logic to deal with the null-ref case, and to deal correctly with Github push events. --- awx/api/views/webhooks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/awx/api/views/webhooks.py b/awx/api/views/webhooks.py index 04ad191016..a7ac706b6b 100644 --- a/awx/api/views/webhooks.py +++ b/awx/api/views/webhooks.py @@ -94,6 +94,8 @@ class WebhookReceiverBase(APIView): value = (value or {}).get(element) except Exception: value = None + if value == '0000000000000000000000000000000000000000': # a deleted ref + value = None return value def get_signature(self): @@ -164,7 +166,7 @@ class GithubWebhookReceiver(WebhookReceiverBase): 'pull_request': 'pull_request.head.sha', 'pull_request_review': 'pull_request.head.sha', 'pull_request_review_comment': 'pull_request.head.sha', - 'push': 'head_commit', + 'push': 'after', 'release': 'release.tag_name', 'commit_comment': 'comment.commit_id', 'create': 'ref',