From 69724620833d3767a4f14f5383cf7b71f72ace35 Mon Sep 17 00:00:00 2001 From: Miodec Date: Wed, 30 Aug 2023 13:52:48 +0200 Subject: [PATCH] build: merge quote report commits in changelog generation --- bin/buildChangelog.mjs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/bin/buildChangelog.mjs b/bin/buildChangelog.mjs index 9a73b71bc..8efdfc903 100644 --- a/bin/buildChangelog.mjs +++ b/bin/buildChangelog.mjs @@ -66,6 +66,17 @@ function itemIsAddingQuotes(item) { return scopeIsQuote && messageAdds; } +function itemIsAddressingQuoteReports(item) { + const scopeIsQuote = + item.scope?.includes("quote") || item.scope?.includes("quotes"); + + const messageReport = + item.message.includes("quote") && + (item.message.includes("report") || item.message.includes("reports")); + + return scopeIsQuote && messageReport; +} + const titles = { feat: "Features", impr: "Improvements", @@ -159,6 +170,11 @@ async function main() { let quoteAddCommits = log.filter((item) => itemIsAddingQuotes(item)); log = log.filter((item) => !itemIsAddingQuotes(item)); + let quoteReportCommits = log.filter((item) => + itemIsAddressingQuoteReports(item) + ); + log = log.filter((item) => !itemIsAddressingQuoteReports(item)); + if (quoteAddCommits.length > 0) { log.push({ hashes: quoteAddCommits.map((item) => item.hashes).flat(), @@ -170,6 +186,17 @@ async function main() { }); } + if (quoteReportCommits.length > 0) { + log.push({ + hashes: quoteReportCommits.map((item) => item.hashes).flat(), + type: "fix", + scope: "quote", + message: "update or remove quotes reported by users", + usernames: quoteReportCommits.map((item) => item.usernames).flat(), + prs: quoteReportCommits.map((item) => item.prs).flat(), + }); + } + let final = ""; final += header + "\n\n\n";