From 4f3f644d791bb04a5b45a6e8531df599f761308b Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Thu, 10 Nov 2022 20:09:04 +0100 Subject: [PATCH] fix: avoid rendering authors with `[bot]` in their name Hides `Renovate[bot]` --- src/markdown.ts | 15 ++++++++------- test/git.test.ts | 3 +-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/markdown.ts b/src/markdown.ts index fef3d7c..1fced6e 100644 --- a/src/markdown.ts +++ b/src/markdown.ts @@ -45,13 +45,14 @@ export async function generateMarkDown (commits: GitCommit[], config: ChangelogC const _authors = new Map, github?: string }>() for (const commit of commits) { - if (commit.author) { - if (!_authors.has(commit.author.name)) { - _authors.set(commit.author.name, { email: new Set([commit.author.email]) }) - } else { - const entry = _authors.get(commit.author.name) - entry.email.add(commit.author.email) - } + if (!commit.author || commit.author.name.includes('[bot]')) { + continue + } + if (!_authors.has(commit.author.name)) { + _authors.set(commit.author.name, { email: new Set([commit.author.email]) }) + } else { + const entry = _authors.get(commit.author.name) + entry.email.add(commit.author.email) } } diff --git a/test/git.test.ts b/test/git.test.ts index 09fc648..1b61dfc 100644 --- a/test/git.test.ts +++ b/test/git.test.ts @@ -303,8 +303,7 @@ describe('git', () => { ### ❤️ Contributors - - Pooya Parsa ([@pi0](http://github.com/pi0)) - - Renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>" + - Pooya Parsa ([@pi0](http://github.com/pi0))" `) }) })