Skip to content
This repository has been archived by the owner on May 5, 2024. It is now read-only.

Commit

Permalink
fix: remove all extraneous newlines from changelogs
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinpinto committed Dec 24, 2019
1 parent 289e532 commit c8e67e1
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 16 deletions.
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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}`)
Expand Down
@@ -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))
@@ -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))
@@ -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))
Expand All @@ -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))
@@ -1,3 +1,2 @@
## Commits

- [[f6f40d9](https://github.com/octocat/Hello-World/commit/f6f40d9fbd1130f7f2357bb54225567dbd7a3793)]: Fix all the bugs (Monalisa Octocat)
@@ -1,3 +1,2 @@
## Reverts

- **backend**: revert a bunch of stuff ([Marvin Pinto](https://github.com/marvinpinto/private-actions-tester/commit/4398ef4ea6f5a61880ca94ecfb8e60d1a38497dd))
@@ -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))
Expand Up @@ -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(() => {
Expand Down
10 changes: 5 additions & 5 deletions packages/automatic-releases/src/utils.ts
Expand Up @@ -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)) {
Expand All @@ -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();
}
}

Expand All @@ -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 => {
Expand Down

0 comments on commit c8e67e1

Please sign in to comment.