From 9e2fd51b8dcd84e36492754e6690e545dbf1bed4 Mon Sep 17 00:00:00 2001 From: Integer Limit <103940576+IntegerLimit@users.noreply.github.com> Date: Thu, 11 Jul 2024 21:54:46 +1000 Subject: [PATCH] Small Changelog Generation Fixes (#792) [FIXUP] [[fixes]] sha = "bf4055fbe4092d72f68bb40bb5d88c624ce5b074" changeFixes = false newBody = ''' [EXPAND] [[messages]] messageTitle = "Upgrade AE2 Stuff to AE2 Stuff Unofficial" messageBody = """ [BREAKING] [DETAILS] details = [ \"Pattern Encoders have been Removed!\", \"Any existing Pattern Encoders, whether items, in patterns or placed, have been remapped to AE2 Interfaces.\", \"All Usages in Recipes have also been changed to AE2 Interfaces!\", ] [DETAILS] [PRIORITY] priority = 25 [PRIORITY] """ [[messages]] messageTitle = "Update GT to 2.8.10" messageBody = """ [BREAKING] [DETAILS] details = [ \"Allows GregTech Data Sticks to Copy ME Hatch Settings\", \"Adds an 'Stocking' Version of ME Hatches and Buses\", \"Support for Displaying Power Substation on Central Monitor\", ] [DETAILS] [PRIORITY] priority = 20 [PRIORITY] [IGNORE] checks = { compareBefore = \"1.7-alpha-4\" } # Only apply this if the commit being compared against is 1.7-alpha-4 or newer [IGNORE] """ [[messages]] messageTitle = "Update Nomi Labs to 0.7.0" messageBody = """ [BREAKING] [DETAILS] details = [ \"Improvement of DME Simulation Chamber (now increases Tiers and Data Counts of Models)\", \"Custom Implementation of Difficulty Lock, now works on Dedicated Servers\", \"Replacement of the Void Dimension, fixing issues with Difficulty Changing\", \"Replacement of Custom Window Titles and Logos, Allowing the Removal of Random Patches\", \"Improvements to FTB Utils and Effortless Building\", \"Allows Setting of Default Keybinds for New Players\", ] [DETAILS] [PRIORITY] priority = 15 [PRIORITY] [IGNORE] checks = { compareBefore = \"1.7-alpha-4\" } # Only apply this if the commit being compared against is 1.7-alpha-4 or newer [IGNORE] """ [EXPAND] ''' [FIXUP] [MOD INFO] [[infos]] projectID = 254317 info = "Replaced by Nomi Labs" [[infos]] projectID = 285612 info = "Replaced by Nomi Labs" [[infos]] projectID = 390886 info = "Replaced by Nomi Labs" [[infos]] projectID = 538092 info = "Replaced by Betterer P2P" [MOD INFO] --- tools/tasks/changelog/parser.ts | 5 +++-- tools/tasks/changelog/pusher.ts | 21 ++++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/tools/tasks/changelog/parser.ts b/tools/tasks/changelog/parser.ts index 8ffe0bb..5f07e37 100644 --- a/tools/tasks/changelog/parser.ts +++ b/tools/tasks/changelog/parser.ts @@ -108,6 +108,9 @@ export async function parseCommitBody( commitObject: Commit, parser: Parser, ): Promise { + if (commitBody.includes(modInfoKey)) + await parseModInfo(commitBody, commitObject); + if (commitBody.includes(expandKey)) { await parseExpand(commitBody, commitObject, parser); return true; @@ -132,8 +135,6 @@ export async function parseCommitBody( commitObject.priority = newPriority; } - if (commitBody.includes(modInfoKey)) - await parseModInfo(commitBody, commitObject); if (commitBody.includes(detailsKey)) { await parseDetails(commitMessage, commitBody, commitObject, parser); return true; diff --git a/tools/tasks/changelog/pusher.ts b/tools/tasks/changelog/pusher.ts index 16b0763..910fa49 100644 --- a/tools/tasks/changelog/pusher.ts +++ b/tools/tasks/changelog/pusher.ts @@ -8,6 +8,12 @@ import { getIssueURL, getNewestIssueURLs } from "#utils/util.ts"; let data: ChangelogData; let octokit: Octokit; +// How many lines the changelog (excluding the commit log) can be before the commit log is excluded. +const sectionLinesBeforeCommitLogExcluded = 50; + +// How many lines the commit log can be before its is excluded. +const logLinesBeforeCommitLogExcluded = 20; + export default async function pushAll(inputData: ChangelogData): Promise { pushTitle(inputData); await pushChangelog(inputData); @@ -65,12 +71,17 @@ export async function pushChangelog(inputData: ChangelogData): Promise { // Push the commit log if (data.commitList.length > 0) { - sortCommitList(data.commitList, (commit) => commit); + if ( + data.builder.length < sectionLinesBeforeCommitLogExcluded && + data.commitList.length < logLinesBeforeCommitLogExcluded + ) { + sortCommitList(data.commitList, (commit) => commit); - data.builder.push("## Commits"); - data.commitList.forEach((commit) => { - data.builder.push(formatCommit(commit)); - }); + data.builder.push("## Commits"); + data.commitList.forEach((commit) => { + data.builder.push(formatCommit(commit)); + }); + } } else { // No Commit List = No Changes data.builder.push("");