Some additional fixes when testing this branch
This commit is contained in:
		
							parent
							
								
									91c829bd14
								
							
						
					
					
						commit
						48ee4671a7
					
				
					 1 changed files with 29 additions and 15 deletions
				
			
		|  | @ -765,7 +765,7 @@ class GithubBuildTrigger(BuildTriggerHandler): | |||
|         commit_info['author']['url'] = sender.get('html_url', '') | ||||
| 
 | ||||
|     if 'committer' in head_commit: | ||||
|       commit_info['author'] = { | ||||
|       commit_info['committer'] = { | ||||
|         'username': head_commit['committer'].get('username'), | ||||
|       } | ||||
| 
 | ||||
|  | @ -960,25 +960,39 @@ class GithubBuildTrigger(BuildTriggerHandler): | |||
| 
 | ||||
|     config = self.config | ||||
|     if field_name == 'tag_name': | ||||
|       gh_client = self._get_client() | ||||
|       source = config['build_source'] | ||||
|       repo = gh_client.get_repo(source) | ||||
|       return [tag.name for tag in repo.get_tags()] | ||||
|       try: | ||||
|         gh_client = self._get_client() | ||||
|         source = config['build_source'] | ||||
|         repo = gh_client.get_repo(source) | ||||
|         return [tag.name for tag in repo.get_tags()] | ||||
|       except GitHubBadCredentialsException: | ||||
|         return [] | ||||
|       except GithubException: | ||||
|         logger.exception("Got GitHub Exception when trying to list tags for trigger %s", | ||||
|                          self.trigger.id) | ||||
|         return [] | ||||
| 
 | ||||
|     if field_name == 'branch_name': | ||||
|       gh_client = self._get_client() | ||||
|       source = config['build_source'] | ||||
|       repo = gh_client.get_repo(source) | ||||
|       branches = [branch.name for branch in repo.get_branches()] | ||||
|       try: | ||||
|         gh_client = self._get_client() | ||||
|         source = config['build_source'] | ||||
|         repo = gh_client.get_repo(source) | ||||
|         branches = [branch.name for branch in repo.get_branches()] | ||||
| 
 | ||||
|       if not repo.default_branch in branches: | ||||
|         branches.insert(0, repo.default_branch) | ||||
|         if not repo.default_branch in branches: | ||||
|           branches.insert(0, repo.default_branch) | ||||
| 
 | ||||
|       if branches[0] != repo.default_branch: | ||||
|         branches.remove(repo.default_branch) | ||||
|         branches.insert(0, repo.default_branch) | ||||
|         if branches[0] != repo.default_branch: | ||||
|           branches.remove(repo.default_branch) | ||||
|           branches.insert(0, repo.default_branch) | ||||
| 
 | ||||
|       return branches | ||||
|         return branches | ||||
|       except GitHubBadCredentialsException: | ||||
|         return ['master'] | ||||
|       except GithubException: | ||||
|         logger.exception("Got GitHub Exception when trying to list branches for trigger %s", | ||||
|                          self.trigger.id) | ||||
|         return ['master'] | ||||
| 
 | ||||
|     return None | ||||
| 
 | ||||
|  |  | |||
		Reference in a new issue