mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 15:04:52 +09:00
Add user section to changelog script
This commit is contained in:
2 files changed
+27
-5
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user