1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Tools: Improve getting GitHub name for git-changelog

This commit is contained in:
Laurent Cozic 2024-03-18 18:11:19 +00:00
parent 56b010ba0e
commit 42483a4d46

View File

@ -273,6 +273,11 @@ export const gitCurrentBranch = async (): Promise<string> => {
}; };
export async function githubUsername(email: string, name: string) { export async function githubUsername(email: string, name: string) {
if (email.endsWith('@users.noreply.github.com')) {
const splitted = email.split('@')[0].split('+');
return splitted.length === 1 ? splitted[0] : splitted[1];
}
const cache = await loadGitHubUsernameCache(); const cache = await loadGitHubUsernameCache();
const cacheKey = `${email}:${name}`; const cacheKey = `${email}:${name}`;
if (cacheKey in cache) return cache[cacheKey]; if (cacheKey in cache) return cache[cacheKey];