mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 16:13:12 +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,
|
html_url: string,
|
||||||
state: string,
|
state: string,
|
||||||
body?: string | null,
|
body?: string | null,
|
||||||
|
user: {
|
||||||
|
login: string,
|
||||||
|
url: string,
|
||||||
|
html_url: string,
|
||||||
|
}
|
||||||
pull_request?: {
|
pull_request?: {
|
||||||
url: string,
|
url: string,
|
||||||
html_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)]);
|
const sections = new Set([...changelogSections, ...Object.keys(changelog)]);
|
||||||
for (const section of sections) {
|
for (const section of sections) {
|
||||||
if (section in changelog) {
|
if (section in changelog) {
|
||||||
@@ -209,6 +215,9 @@ function printMarkdown(changelog: Changelog, issues: Issue[], refText: (issue: I
|
|||||||
console.log();
|
console.log();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(`Many thanks to the following for contributing to this release:`);
|
||||||
|
console.log(users.map(userText).join("\n"))
|
||||||
}
|
}
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
@@ -222,13 +231,21 @@ async function main() {
|
|||||||
));
|
));
|
||||||
|
|
||||||
const changelog = changelogFromPullRequests(pullRequests, issues);
|
const changelog = changelogFromPullRequests(pullRequests, issues);
|
||||||
|
const users = [...new Map(pullRequests.map(issue => [issue.user.login, issue.user])).values()]
|
||||||
|
|
||||||
console.log();
|
console.log();
|
||||||
console.log("=== Github markdown ===");
|
console.log("=== Github Release Markdown ===");
|
||||||
printMarkdown(changelog, issues, issue => `${repository}#${issue.number}`);
|
printMarkdown(changelog, issues, users,
|
||||||
|
issue => `${repository}#${issue.number}`,
|
||||||
|
user => `@${user.login}`,
|
||||||
|
);
|
||||||
|
|
||||||
console.log();
|
console.log();
|
||||||
console.log("=== Discord markdown ===");
|
console.log("=== Discord / Changelog Markdown ===");
|
||||||
printMarkdown(changelog, issues, issue => `[#${issue.number}](<${issue.html_url}>)`);
|
printMarkdown(changelog, issues, users,
|
||||||
|
issue => `[#${issue.number}](<${issue.html_url}>)`,
|
||||||
|
user => `[@${user.login}](<${user.html_url}>)`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (import.meta.main) {
|
if (import.meta.main) {
|
||||||
|
|||||||
Reference in new issue
Block a user