Skip to content

Commit f3be575

Browse files
authored
Filter private emails out (#6900)
1 parent 8129527 commit f3be575

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/github/githubRepository.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ export class GitHubRepository extends Disposable {
897897
const { data } = await octokit.call(octokit.api.users.listEmailsForAuthenticatedUser, {});
898898
Logger.debug(`Fetch authenticated user emails - done`, this.id);
899899
// sort the primary email to the first index
900-
return data.sort((a, b) => +b.primary - +a.primary).map(email => email.email);
900+
return data.filter(email => email.visibility === 'public' || email.email.toLowerCase().endsWith('@users.noreply.github.com')).sort((a, b) => +b.primary - +a.primary).map(email => email.email);
901901
} catch (e) {
902902
Logger.error(`Unable to fetch authenticated user emails: ${e}`, this.id);
903903
return [];

0 commit comments

Comments
 (0)