From 6aece0e19c0875a1852c6aae8c42cc490d472adb Mon Sep 17 00:00:00 2001 From: Raisa Primerova <48605821+RayRedGoose@users.noreply.github.com> Date: Mon, 23 Oct 2023 17:06:25 -0600 Subject: [PATCH] feat: Update changelog generator (#54) [category:Infrastructure] --- scripts/utils/update-changelog.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/utils/update-changelog.ts b/scripts/utils/update-changelog.ts index cf23ced..2c4b46d 100644 --- a/scripts/utils/update-changelog.ts +++ b/scripts/utils/update-changelog.ts @@ -8,15 +8,17 @@ const header = `--- ---`; const [prefix] = PACKAGE.split('-').reverse(); -const regex = new RegExp(`^# (${prefix}|all|components)`, 'i'); +const allowedTitles = [prefix, 'all', 'other', 'infrastructure', 'documentation']; +const regex = new RegExp(`^# (${allowedTitles.join('|')})`, 'i'); -const changelogBody = CHANGESET_BODY.split('##') +const changelogBody = CHANGESET_BODY.replace('# Components', '# Other') + .split('##') .filter(block => regex.test(block)) .map(b => b.replace(/# [a-zA-Z0-9_ ]*\n/g, a => { // Canvas Kit's changelog generator defaults section headings to "Components." // We're updating that default with use "Other" instead. - const updatedTitle = a.replace(/# |\n/g, '').replace('Components', 'Other'); + const updatedTitle = a.replace(/# |\n/g, ''); return `**${updatedTitle}**\n`; }) )