github_webhook: Use author's full name if username is not available.

In cases where the webhook payload doesn't have the username for the
author of a particular commit (this can happen if the author doesn't
have a GitHub account or the author's email is not associated with
their GitHub account), we now use the author's full name to format
messages.
This commit is contained in:
Eeshan Garg
2017-04-29 03:46:07 -02:30
committed by Tim Abbott
parent cab87fef2a
commit 8ef18463d6
3 changed files with 187 additions and 1 deletions

View File

@@ -180,7 +180,8 @@ def get_push_tags_body(payload):
def get_push_commits_body(payload):
# type: (Dict[str, Any]) -> Text
commits_data = [{
'name': commit['author']['username'],
'name': (commit.get('author').get('username') or
commit.get('author').get('name')),
'sha': commit['id'],
'url': commit['url'],
'message': commit['message']