Sometimes GitHub doesn't return repo permissions

The Projects API isn't actually stable as of today, according to
https://developer.github.com/v3/projects/collaborators/. As such, no
assumptions can be made about what it returns. In older GitHub
Enterprise versions, for instance, the permission key is missing.

Change-Id: I3e706a209d263c698e76cb7e6b636d69d608ecc9
This commit is contained in:
Clint Byrum 2018-04-26 20:47:11 -07:00
parent f3194ce547
commit e94f951c0b
1 changed files with 1 additions and 1 deletions

View File

@ -1052,7 +1052,7 @@ class GithubConnection(BaseConnection):
return 'none'
# get permissions from the data
return perms.json()['permission']
return perms.json().get('permission', 'none')
def commentPull(self, project, pr_number, message):
github = self.getGithubClient(project)