From c4df94647b0f0679ebdd7eecf44aafe58341ccdf Mon Sep 17 00:00:00 2001 From: John Campion Date: Tue, 4 Apr 2023 20:48:13 -0400 Subject: [PATCH] feat: add excludeAuthors option (#58) Checks for any of the strings in name or email to exclude them from authors. Also, can disable contributors section with `excludeAuthors: ['']` --- src/config.ts | 2 ++ src/markdown.ts | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/config.ts b/src/config.ts index 4b6c43c..5c9f151 100644 --- a/src/config.ts +++ b/src/config.ts @@ -25,6 +25,7 @@ export interface ChangelogConfig { tagMessage?: string; tagBody?: string; }; + excludeAuthors: string[]; } const getDefaultConfig = () => @@ -64,6 +65,7 @@ const getDefaultConfig = () => tagMessage: "v{{newVersion}}", tagBody: "v{{newVersion}}", }, + excludeAuthors: [], }; export async function loadChangelogConfig( diff --git a/src/markdown.ts b/src/markdown.ts index cdb0718..423546f 100644 --- a/src/markdown.ts +++ b/src/markdown.ts @@ -51,6 +51,14 @@ export async function generateMarkDown( if (!name || name.includes("[bot]")) { continue; } + if ( + config.excludeAuthors && + config.excludeAuthors.some( + (v) => name.includes(v) || commit.author.email?.includes(v) + ) + ) { + continue; + } if (_authors.has(name)) { const entry = _authors.get(name); entry.email.add(commit.author.email);