Skip to content

Commit

Permalink
fix: a few minor tweaks to ruby template (googleapis#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe authored Aug 16, 2019
1 parent 65f0718 commit 1b6ed02
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion __snapshots__/indent-commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ feat: my awesome commit message
* testing second line
`

exports['indentCommit ignores empty lines 1'] = `
exports['indentCommit only adds lines prefixed with * to CHANGELOG 1'] = `
feat: my awesome commit message
* testing one line
* testing second line
Expand Down
2 changes: 1 addition & 1 deletion src/release-pr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export class ReleasePR {
includePackageName = false
) {
const title = includePackageName
? `chore: release ${this.packageName}@${version}`
? `Release ${this.packageName} ${version}`
: `chore: release ${version}`;
const body = `:robot: I have created a release \\*beep\\* \\*boop\\* \n---\n${changelogEntry}\n\nThis PR was generated with [Release Please](https://github.com/googleapis/release-please).`;
const pr: number = await this.gh.openPR({
Expand Down
6 changes: 4 additions & 2 deletions src/util/indent-commit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ import { Commit } from '../graphql-to-commits';
export function indentCommit(commit: Commit): string {
const reduced: string[] = [];
commit.message.split(/\r?\n/).forEach((line, i) => {
if (line.trim() === '') return;
if (i !== 0) line = ` ${line}`;
reduced.push(line);
// to show up in CHANGELOG lines must start with '*'.
if (/^\s*\*/.test(line) || i === 0) {
reduced.push(line);
}
});
return reduced.join('\n');
}
4 changes: 2 additions & 2 deletions templates/commit.hbs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
* {{#if subject}} {{~subject}} {{~else}} {{~header}} {{~/if}}
{{#if body}}{{body}}{{~/if}}
* {{#if subject}} {{~subject}} {{~else}} {{~header}} {{~/if}}{{#if body}}
{{body}}{{~/if}}
4 changes: 1 addition & 3 deletions templates/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,4 @@

{{/if}}
{{#each commits}}
{{> commit root=@root}}{{/each}}

{{/each}}
{{> commit root=@root}}{{/each}}{{/each}}
6 changes: 4 additions & 2 deletions test/util/indent-commit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ describe('indentCommit', () => {
);
});

it('ignores empty lines', () => {
it('only adds lines prefixed with * to CHANGELOG', () => {
snapshot(
indentCommit({
message: `feat: my awesome commit message
* testing one line
* testing second line
* testing second line`,
[Fixes #32]`,
sha: 'abc123',
files: [],
})
Expand Down

0 comments on commit 1b6ed02

Please sign in to comment.