Skip to content

Commit

Permalink
fix: always retrieve github emails when preferredEmailDomain is set (
Browse files Browse the repository at this point in the history
…#3584)

Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com>
  • Loading branch information
thesuperzapper authored Jul 15, 2024
1 parent bd73825 commit fb20f3f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions connector/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,10 @@ func (c *githubConnector) user(ctx context.Context, client *http.Client) (user,
return u, err
}

// Only public user emails are returned by 'GET /user'. u.Email will be empty
// if a users' email is private. We must retrieve private emails explicitly.
if u.Email == "" {
// Only public user emails are returned by 'GET /user'.
// If a user has no public email, we must retrieve private emails explicitly.
// If preferredEmailDomain is set, we always need to retrieve all emails.
if u.Email == "" || c.preferredEmailDomain != "" {
var err error
if u.Email, err = c.userEmail(ctx, client); err != nil {
return u, err
Expand Down

0 comments on commit fb20f3f

Please sign in to comment.