From 2c30fa4a943cba2abc171045cc9941883ad6dd2d Mon Sep 17 00:00:00 2001 From: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com> Date: Sat, 25 Apr 2026 22:38:23 +0100 Subject: [PATCH] Add user section to changelog script --- scripts/github_api.mts | 5 +++++ scripts/pr_to_changelog.mts | 27 ++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/scripts/github_api.mts b/scripts/github_api.mts index 3b4f16ea..1f03a51c 100644 --- a/scripts/github_api.mts +++ b/scripts/github_api.mts @@ -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, diff --git a/scripts/pr_to_changelog.mts b/scripts/pr_to_changelog.mts index 87562a62..a5bbb7bf 100644 --- a/scripts/pr_to_changelog.mts +++ b/scripts/pr_to_changelog.mts @@ -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) {