From cd3e175876af818d25cb5537a8f35d9e2c8cdc23 Mon Sep 17 00:00:00 2001 From: IntegerLimit <103940576+IntegerLimit@users.noreply.github.com> Date: Sat, 21 Oct 2023 13:31:46 +1100 Subject: [PATCH] Fix Removal of Fixup Sections in Github Commits (#467) [COMBINE] commits = ["fbd1584e7baed4a3603e3c810066603185f1b230"] [COMBINE] --- tools/tasks/changelog/specialParser.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/tasks/changelog/specialParser.ts b/tools/tasks/changelog/specialParser.ts index 123d3fa..ea27a91 100644 --- a/tools/tasks/changelog/specialParser.ts +++ b/tools/tasks/changelog/specialParser.ts @@ -42,7 +42,8 @@ export async function parseFixUp(commit: Commit): Promise { data.commitFixes.set(commit.hash, { sha: commit.hash, newTitle: commit.message, - newBody: commit.body.replace(matter.matter.trim(), ""), + // Replace "\r\n" (Caused by editing on GitHub) with "\n", as the output matter has this done. + newBody: commit.body.replace(/\r\n/g, "\n").replace(matter.matter.trim(), ""), }); }, ); @@ -183,7 +184,8 @@ async function parse( // Remove everything before first delimiter in body const list = commitBody.split(delimiter); list.shift(); - const body = `${delimiter} ${list.join(delimiter)}`.split("\r\n").join("\n"); + // Replace "\r\n" (Caused by editing on GitHub) with "\n", as \r\n crashes the TOML parser. + const body = `${delimiter} ${list.join(delimiter)}`.replace(/\r\n/g, "\n"); // Parse const parseResult = matter(body, {