From 90b6c3a0fa419221ba8aea052338bcfb582378a8 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Fri, 23 Feb 2024 21:19:35 +0100 Subject: [PATCH] [Tooling] Print contributors of release with changelog script (#619) --- tools/scripts/createReleaseChangelog.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/scripts/createReleaseChangelog.ts b/tools/scripts/createReleaseChangelog.ts index 2ca21ae8..b5b952ee 100644 --- a/tools/scripts/createReleaseChangelog.ts +++ b/tools/scripts/createReleaseChangelog.ts @@ -192,6 +192,14 @@ const createChangelogCommitLine = (commit: Commit): string => { } }; +const getContributors = (commits: Commit[]): string[] => [ + ...new Set( + commits + .map((commit) => commit.authors.map((author) => author.user?.login!).filter((author) => !!author)) + .flat(), + ), +]; + const createChangelog = async (prevReleaseLastCommitSha: string) => { const owner = 'Suwayomi'; const repo = 'Suwayomi-WebUI'; @@ -213,6 +221,10 @@ const createChangelog = async (prevReleaseLastCommitSha: string) => { const commitChangelogLines = commits.map(createChangelogCommitLine); commitChangelogLines.forEach((commit) => console.log('-', commit)); + + const contributors = getContributors(commits); + const contributorString = contributors.reduce((authorCredit, author) => `${authorCredit}, @${author}`); + console.log(`\n\nContributors:\n@${contributorString}`); }; createChangelog(sha).catch((error) => {