diff --git a/packages/automatic-releases/__tests__/automaticReleases.test.ts b/packages/automatic-releases/__tests__/automaticReleases.test.ts index cd631364..1425d105 100644 --- a/packages/automatic-releases/__tests__/automaticReleases.test.ts +++ b/packages/automatic-releases/__tests__/automaticReleases.test.ts @@ -12,7 +12,7 @@ describe('main handler processing automatic releases', () => { const testInputDraft = false; const testInputPrerelease = true; const testInputTitle = 'Development Build'; - const testInputBody = `\n\n## Commits\n\n- [[f6f40d9](https://github.com/octocat/Hello-World/commit/${testGhSHA})]: Fix all the bugs (Monalisa Octocat)`; + const testInputBody = `## Commits\n- [[f6f40d9](https://github.com/octocat/Hello-World/commit/${testGhSHA})]: Fix all the bugs (Monalisa Octocat)`; const testInputFiles = 'file1.txt\nfile2.txt\n*.jar\n\n'; beforeEach(() => { @@ -128,7 +128,7 @@ describe('main handler processing automatic releases', () => { const compareCommitsPayload = JSON.parse( fs.readFileSync(path.join(__dirname, 'payloads', 'compare-commits.json'), 'utf8'), ); - const testInputBody = `\n\n## Commits\n\n- [[f6f40d9](https://github.com/octocat/Hello-World/commit/${testGhSHA})]: Fix all the bugs (Monalisa Octocat) [#22](https://example.com/PR22)`; + const testInputBody = `## Commits\n- [[f6f40d9](https://github.com/octocat/Hello-World/commit/${testGhSHA})]: Fix all the bugs (Monalisa Octocat) [#22](https://example.com/PR22)`; const getPreviousReleaseSHA = nock('https://api.github.com') .matchHeader('authorization', `token ${testGhToken}`) diff --git a/packages/automatic-releases/__tests__/payloads/parsed-commits-breaking-changes-result.txt b/packages/automatic-releases/__tests__/payloads/parsed-commits-breaking-changes-result.txt index 0333671e..2721df25 100644 --- a/packages/automatic-releases/__tests__/payloads/parsed-commits-breaking-changes-result.txt +++ b/packages/automatic-releases/__tests__/payloads/parsed-commits-breaking-changes-result.txt @@ -1,7 +1,5 @@ ## Breaking Changes - - revert a bunch of stuff [#2](https://github.com/marvinpinto/private-actions-tester/pull/2) ([Marvin Pinto](https://github.com/marvinpinto/private-actions-tester/commit/4398ef4ea6f5a61880ca94ecfb8e60d1a38497dd)) ## Reverts - - revert a bunch of stuff [#2](https://github.com/marvinpinto/private-actions-tester/pull/2) ([Marvin Pinto](https://github.com/marvinpinto/private-actions-tester/commit/4398ef4ea6f5a61880ca94ecfb8e60d1a38497dd)) diff --git a/packages/automatic-releases/__tests__/payloads/parsed-commits-multiple-prs-result.txt b/packages/automatic-releases/__tests__/payloads/parsed-commits-multiple-prs-result.txt index a7c6ccb9..46650efd 100644 --- a/packages/automatic-releases/__tests__/payloads/parsed-commits-multiple-prs-result.txt +++ b/packages/automatic-releases/__tests__/payloads/parsed-commits-multiple-prs-result.txt @@ -1,3 +1,2 @@ ## Reverts - - revert a bunch of stuff [#2](https://github.com/marvinpinto/private-actions-tester/pull/2),[#10](https://github.com/marvinpinto/private-actions-tester/pull/10) ([Marvin Pinto](https://github.com/marvinpinto/private-actions-tester/commit/4398ef4ea6f5a61880ca94ecfb8e60d1a38497dd)) diff --git a/packages/automatic-releases/__tests__/payloads/parsed-commits-multiple-result.txt b/packages/automatic-releases/__tests__/payloads/parsed-commits-multiple-result.txt index 886b1865..d298a8f1 100644 --- a/packages/automatic-releases/__tests__/payloads/parsed-commits-multiple-result.txt +++ b/packages/automatic-releases/__tests__/payloads/parsed-commits-multiple-result.txt @@ -1,5 +1,4 @@ ## Features - - add the initial prototype of the automatic-releases GitHub action [#2](https://github.com/marvinpinto/private-actions-tester/pull/2) ([Marvin Pinto](https://github.com/marvinpinto/private-actions-tester/commit/4398ef4ea6f5a61880ca94ecfb8e60d1a38497dd)) - delete previous releases associated with the specified tag [#2](https://github.com/marvinpinto/private-actions-tester/pull/2) ([Marvin Pinto](https://github.com/marvinpinto/private-actions-tester/commit/c01c5105f679a2e692e40877def62ec69a3f9f2b)) - create new GitHub releases [#2](https://github.com/marvinpinto/private-actions-tester/pull/2) ([Marvin Pinto](https://github.com/marvinpinto/private-actions-tester/commit/50c9b2d9400621ffbc0af334d0911c25354ee383)) @@ -8,5 +7,4 @@ - use the commit list to generate a changelog [#2](https://github.com/marvinpinto/private-actions-tester/pull/2) ([Marvin Pinto](https://github.com/marvinpinto/private-actions-tester/commit/1be97dbfbc3d399b38dfaa0b23a31816fcc000d5)) ## Tests - - pr strings [#2](https://github.com/marvinpinto/private-actions-tester/pull/2) ([Marvin Pinto](https://github.com/marvinpinto/private-actions-tester/commit/377432c80b3955c3b2e4b0a045b0a90f8abe3480)) diff --git a/packages/automatic-releases/__tests__/payloads/parsed-commits-non-conforming-result.txt b/packages/automatic-releases/__tests__/payloads/parsed-commits-non-conforming-result.txt index 3204d44c..a6fe045c 100644 --- a/packages/automatic-releases/__tests__/payloads/parsed-commits-non-conforming-result.txt +++ b/packages/automatic-releases/__tests__/payloads/parsed-commits-non-conforming-result.txt @@ -1,3 +1,2 @@ ## Commits - - [[f6f40d9](https://github.com/octocat/Hello-World/commit/f6f40d9fbd1130f7f2357bb54225567dbd7a3793)]: Fix all the bugs (Monalisa Octocat) diff --git a/packages/automatic-releases/__tests__/payloads/parsed-commits-scoped-result.txt b/packages/automatic-releases/__tests__/payloads/parsed-commits-scoped-result.txt index 4dca064b..adad4132 100644 --- a/packages/automatic-releases/__tests__/payloads/parsed-commits-scoped-result.txt +++ b/packages/automatic-releases/__tests__/payloads/parsed-commits-scoped-result.txt @@ -1,3 +1,2 @@ ## Reverts - - **backend**: revert a bunch of stuff ([Marvin Pinto](https://github.com/marvinpinto/private-actions-tester/commit/4398ef4ea6f5a61880ca94ecfb8e60d1a38497dd)) diff --git a/packages/automatic-releases/__tests__/payloads/parsed-commits-single-result.txt b/packages/automatic-releases/__tests__/payloads/parsed-commits-single-result.txt index 1fa292f8..ba40bd32 100644 --- a/packages/automatic-releases/__tests__/payloads/parsed-commits-single-result.txt +++ b/packages/automatic-releases/__tests__/payloads/parsed-commits-single-result.txt @@ -1,3 +1,2 @@ ## Reverts - - revert a bunch of stuff [#2](https://github.com/marvinpinto/private-actions-tester/pull/2) ([Marvin Pinto](https://github.com/marvinpinto/private-actions-tester/commit/4398ef4ea6f5a61880ca94ecfb8e60d1a38497dd)) diff --git a/packages/automatic-releases/__tests__/taggedReleases.test.ts b/packages/automatic-releases/__tests__/taggedReleases.test.ts index 1d49b7ae..759d2948 100644 --- a/packages/automatic-releases/__tests__/taggedReleases.test.ts +++ b/packages/automatic-releases/__tests__/taggedReleases.test.ts @@ -10,7 +10,7 @@ describe('main handler processing tagged releases', () => { const testGhSHA = 'f6f40d9fbd1130f7f2357bb54225567dbd7a3793'; const testInputDraft = false; const testInputPrerelease = false; - const testInputBody = `\n\n## Commits\n\n- [[f6f40d9](https://github.com/octocat/Hello-World/commit/${testGhSHA})]: Fix all the bugs (Monalisa Octocat)`; + const testInputBody = `## Commits\n- [[f6f40d9](https://github.com/octocat/Hello-World/commit/${testGhSHA})]: Fix all the bugs (Monalisa Octocat)`; const testInputFiles = 'file1.txt\nfile2.txt\n*.jar\n\n'; beforeEach(() => { diff --git a/packages/automatic-releases/src/utils.ts b/packages/automatic-releases/src/utils.ts index f1c01578..d131d0bc 100644 --- a/packages/automatic-releases/src/utils.ts +++ b/packages/automatic-releases/src/utils.ts @@ -109,8 +109,8 @@ export const generateChangelogFromParsedCommits = (parsedCommits: ParsedCommits[ .map(val => getFormattedChangelogEntry(val)) .reduce((acc, line) => `${acc}\n${line}`, ''); if (breaking) { - changelog += '\n\n## Breaking Changes\n'; - changelog += breaking; + changelog += '## Breaking Changes\n'; + changelog += breaking.trim(); } for (const key of Object.keys(ConventionalCommitTypes)) { @@ -120,7 +120,7 @@ export const generateChangelogFromParsedCommits = (parsedCommits: ParsedCommits[ .reduce((acc, line) => `${acc}\n${line}`, ''); if (clBlock) { changelog += `\n\n## ${ConventionalCommitTypes[key]}\n`; - changelog += clBlock; + changelog += clBlock.trim(); } } @@ -131,10 +131,10 @@ export const generateChangelogFromParsedCommits = (parsedCommits: ParsedCommits[ .reduce((acc, line) => `${acc}\n${line}`, ''); if (commits) { changelog += '\n\n## Commits\n'; - changelog += commits; + changelog += commits.trim(); } - return changelog; + return changelog.trim(); }; export const isBreakingChange = ({body, footer}): boolean => {