From 56be893d7e14ba0d031e35aaf9c2ad2389df26ff Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 17 Mar 2015 16:54:18 -0400 Subject: [PATCH] Fix Github Trigger handling when there is no committer --- endpoints/trigger.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/endpoints/trigger.py b/endpoints/trigger.py index bfd9f8ce7..6f7fbc275 100644 --- a/endpoints/trigger.py +++ b/endpoints/trigger.py @@ -318,21 +318,27 @@ class GithubBuildTrigger(BuildTrigger): logger.exception('Could not load data for commit') return - return { + commit_info = { 'url': commit.html_url, 'message': commit.commit.message, - 'author': { + 'date': commit.last_modified + } + + if commit.author: + commit_info['author'] = { 'username': commit.author.login, 'avatar_url': commit.author.avatar_url, 'url': commit.author.html_url - }, - 'committer': { + } + + if commit.committer: + commit_info['committer'] = { 'username': commit.committer.login, 'avatar_url': commit.committer.avatar_url, 'url': commit.committer.html_url - }, - 'date': commit.last_modified - } + } + + return commit_info @staticmethod def _prepare_build(config, repo, commit_sha, build_name, ref):