Skip to content

Commit

Permalink
Choose a public email to use the app (#455)
Browse files Browse the repository at this point in the history
Co-authored-by: Ushi Hiraga <[email protected]>
  • Loading branch information
UshiHiraga and Ushi Hiraga authored Dec 15, 2024
1 parent e4b6a23 commit 2e56b32
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions netlify/edge-functions/github-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ async function getUser(token: string) {
}

const emails = (await emailResponse.json()) as Array<{ email: string; primary: boolean; visibility: string }>
const primaryEmail = emails.find((email) => email.primary && email.visibility === "public")
const primaryEmail = emails.find((email) => email.visibility === "public")

if (!primaryEmail) {
throw new Error("No public primary email found. Check your privacy settings in https://github.com/settings/emails")
throw new Error("No public email found. Check your email settings in https://github.com/settings/emails")
}

return { login, name, email: primaryEmail.email }
Expand Down

0 comments on commit 2e56b32

Please sign in to comment.