Skip to content

Commit

Permalink
[docs-infra] Try to parse author login from commit (#42443)
Browse files Browse the repository at this point in the history
  • Loading branch information
brijeshb42 authored May 29, 2024
1 parent 4a1101b commit 77f606b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion scripts/releaseChangelog.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,18 @@ async function main(argv) {
return chalk.red("TODO INSERT AUTHOR'S USERNAME");
}

return commit.author?.login;
const authorLogin = commit.author.login;

if (authorLogin === 'github-actions[bot]') {
const authorFromMessage = /\(@(?<author>[a-zA-Z0-9-_]+)\) \(#[\d]+\)/.exec(
commit.commit.message.split('\n')[0],
);
if (authorFromMessage.groups?.author) {
return authorFromMessage.groups.author;
}
}

return authorLogin;
};

const authors = Array.from(
Expand Down

0 comments on commit 77f606b

Please sign in to comment.