Skip to content

Commit

Permalink
[communitybridge#3884] Bug/Fetching user by email
Browse files Browse the repository at this point in the history
- Handle github search by email with an empty list

Signed-off-by: Harold Wanyama <hwanyama@contractor.linuxfoundation.org>
  • Loading branch information
nickmango committed Jun 9, 2023
1 parent 694dd80 commit 62916df
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cla-backend/cla/models/github_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,9 @@ def get_github_user_by_email(self, email, installation_id):
try:
cla.log.debug('Searching for GitHub user by email handle: %s', email)
users_by_email = self.client.search_users(f"{email} in:email")
if len(users_by_email) == 0:
cla.log.debug('No GitHub user found with email handle: %s', email)
return None
return users_by_email[0]
except UnknownObjectException:
cla.log.error('Could not find GitHub user %s' ,
Expand Down

0 comments on commit 62916df

Please sign in to comment.