From 800f82df24512d42265eb2dec79f1c10273619ba Mon Sep 17 00:00:00 2001 From: Daniel Levi-Minzi <51272568+dleviminzi@users.noreply.github.com> Date: Mon, 7 Oct 2024 14:50:57 -0400 Subject: [PATCH] Fix: regex for auto changelog (#594) --- .github/workflows/release-changelog.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release-changelog.yml b/.github/workflows/release-changelog.yml index 2932137f2..db22ef916 100644 --- a/.github/workflows/release-changelog.yml +++ b/.github/workflows/release-changelog.yml @@ -37,25 +37,21 @@ jobs: } const release = context.payload.release; - - // TODO: remove this when after first real release - console.log("release", release); - const lines = release.body.split('\n'); const feats = []; const fixes = []; for (const line of lines) { if (line.startsWith('*')) { - const m = line.match(/^\*\s*(Feat|Fix):\s*(.*)$/); + const m = line.match(/^\*\s*([fF]eat|[fF]ix):\s*(.*)\s*/); if (m) { const [_, type, description] = m; const byIndex = description.indexOf('by'); - if (type === 'Feat') { + if (type.toLowerCase() === 'feat') { const cleanedDesc = description.slice(0, byIndex).trim(); feats.push(cleanedDesc); - } else if (type === 'Fix') { + } else if (type.toLowerCase() === 'fix') { const cleanedDesc = description.slice(0, byIndex).trim(); fixes.push(cleanedDesc); } @@ -71,7 +67,7 @@ jobs: } const featsString = feats.map(feat => `- ${feat}`).join('\n'); - const fixesString = fixes.map(fix => `- ${fix}`).join('\n'); + const fixesString = fixes.map(fix => `- fix ${fix}`).join('\n'); core.setOutput('name', release.name.replace(/\s+/g, '-')); core.setOutput('feats', featsString);