From e7f98d991f5e80ef299eb32fb87a8c543f0cf99c Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 29 Oct 2014 12:04:34 -0400 Subject: [PATCH] Fix bug which caused manual builds to always build the master branch --- endpoints/trigger.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/endpoints/trigger.py b/endpoints/trigger.py index 61c5e7ef8..289eb5937 100644 --- a/endpoints/trigger.py +++ b/endpoints/trigger.py @@ -403,12 +403,13 @@ class GithubBuildTrigger(BuildTrigger): gh_client = self._get_client(auth_token) repo = gh_client.get_repo(source) - master = repo.get_branch(repo.default_branch) - master_sha = master.commit.sha - short_sha = GithubBuildTrigger.get_display_name(master_sha) - ref = 'refs/heads/%s' % (run_parameters.get('branch_name') or repo.default_branch) + branch_name = run_parameters.get('branch_name') or repo.default_branch + branch = repo.get_branch(branch_name) + branch_sha = branch.commit.sha + short_sha = GithubBuildTrigger.get_display_name(branch_sha) + ref = 'refs/heads/%s' % (branch_name) - return self._prepare_build(config, repo, master_sha, short_sha, ref) + return self._prepare_build(config, repo, branch_sha, short_sha, ref) except GithubException as ghe: raise TriggerStartException(ghe.data['message'])