Add the project to GithubUser
The data of the GithubUser object is queried lazy in order to save
requests. In the case of Github apps on GHE we need to supply the
related project in order to do the lazy requests authenticated as the
correct installation.
Change-Id: Ic35d870be17eaf99bfe398fadfc122375be0f963
diff --git a/zuul/driver/github/githubconnection.py b/zuul/driver/github/githubconnection.py
index 87a25b0..cb2de20 100644
--- a/zuul/driver/github/githubconnection.py
+++ b/zuul/driver/github/githubconnection.py
@@ -349,7 +349,9 @@
def _get_sender(self, body):
login = body.get('sender').get('login')
if login:
- return self.connection.getUser(login)
+ # TODO(tobiash): it might be better to plumb in the installation id
+ project = body.get('repository', {}).get('full_name')
+ return self.connection.getUser(login, project=project)
def run(self):
while True:
@@ -972,8 +974,8 @@
log_rate_limit(self.log, github)
return reviews
- def getUser(self, login):
- return GithubUser(self.getGithubClient(), login)
+ def getUser(self, login, project=None):
+ return GithubUser(self.getGithubClient(project), login)
def getUserUri(self, login):
return 'https://%s/%s' % (self.server, login)