[Tooling] Print contributors of release with changelog script (#619)

This commit is contained in:
schroda
2024-02-23 21:19:35 +01:00
committed by GitHub
parent e310ec3ba7
commit 90b6c3a0fa

View File

@@ -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 createChangelog = async (prevReleaseLastCommitSha: string) => {
const owner = 'Suwayomi'; const owner = 'Suwayomi';
const repo = 'Suwayomi-WebUI'; const repo = 'Suwayomi-WebUI';
@@ -213,6 +221,10 @@ const createChangelog = async (prevReleaseLastCommitSha: string) => {
const commitChangelogLines = commits.map(createChangelogCommitLine); const commitChangelogLines = commits.map(createChangelogCommitLine);
commitChangelogLines.forEach((commit) => console.log('-', commit)); 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) => { createChangelog(sha).catch((error) => {