Add user section to changelog script

This commit is contained in:
Cooldude2606 committed 2026-04-25 22:38:23 +01:00
1 parent a22186ca01
commit 2c30fa4a94
2 files changed
+27 -5

No files matched your search

+5
View File
@@ -95,6 +95,11 @@ export interface Issue {
html_url: string,
state: string,
body?: string | null,
user: {
login: string,
url: string,
html_url: string,
}
pull_request?: {
url: string,
html_url: string,
+22 -5
View File
@@ -187,7 +187,13 @@ async function fetchIssuesUpdatedSince(since: string) {
);
}
function printMarkdown(changelog: Changelog, issues: Issue[], refText: (issue: Issue) => string) {
function printMarkdown(
changelog: Changelog,
issues: Issue[],
users: Issue["user"][],
refText: (issue: Issue) => string,
userText: (user: Issue["user"]) => string,
) {
const sections = new Set([...changelogSections, ...Object.keys(changelog)]);
for (const section of sections) {
if (section in changelog) {
@@ -209,6 +215,9 @@ function printMarkdown(changelog: Changelog, issues: Issue[], refText: (issue: I
console.log();
}
}
console.log(`Many thanks to the following for contributing to this release:`);
console.log(users.map(userText).join("\n"))
}
async function main() {
@@ -222,13 +231,21 @@ async function main() {
));
const changelog = changelogFromPullRequests(pullRequests, issues);
const users = [...new Map(pullRequests.map(issue => [issue.user.login, issue.user])).values()]
console.log();
console.log("=== Github markdown ===");
printMarkdown(changelog, issues, issue => `${repository}#${issue.number}`);
console.log("=== Github Release Markdown ===");
printMarkdown(changelog, issues, users,
issue => `${repository}#${issue.number}`,
user => `@${user.login}`,
);
console.log();
console.log("=== Discord markdown ===");
printMarkdown(changelog, issues, issue => `[#${issue.number}](<${issue.html_url}>)`);
console.log("=== Discord / Changelog Markdown ===");
printMarkdown(changelog, issues, users,
issue => `[#${issue.number}](<${issue.html_url}>)`,
user => `[@${user.login}](<${user.html_url}>)`
);
}
if (import.meta.main) {