Skip to content

Commit

Permalink
fix: handle additional content after release-as: footer (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe authored Mar 16, 2020
1 parent 0931ea7 commit dcdc054
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/release-pr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class ReleasePR {
cc: ConventionalCommits,
latestTag: GitHubTag | undefined
): Promise<ReleaseCandidate> {
const releaseAsRe = /release-as: v?([0-9]+\.[0-9]+\.[0-9a-z-])+$/i;
const releaseAsRe = /release-as: v?([0-9]+\.[0-9]+\.[0-9a-z-])+\s*/i;
const previousTag = latestTag ? latestTag.name : undefined;
let version = latestTag ? latestTag.version : this.defaultInitialVersion();

Expand Down
32 changes: 32 additions & 0 deletions test/release-pr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,5 +308,37 @@ describe('GitHub', () => {
const candidate = await rp.coerceReleaseCandidate(cc);
expect(candidate.version).to.equal('2.0.0');
});

it('it handles additional content after release-as: footer', async () => {
const rp = new TestableReleasePR({
repoUrl: 'googleapis/nodejs',
packageName: '@google-cloud/nodejs',
apiUrl: 'github.com',
releaseType: ReleaseType.Node,
});
const cc = new ConventionalCommits({
commits: [
{
sha: 'abc123',
message: 'fix: addresses issues with library',
files: [],
},
{
sha: 'abc124',
message:
'feat: adds a slick new feature\nRelease-As: 2.0.0\r\nSecond Footer: hello',
files: [],
},
{
sha: 'abc125',
message: 'fix: another fix\n\nRelease-As: 3.0.0',
files: [],
},
],
githubRepoUrl: 'googleapis/nodejs',
});
const candidate = await rp.coerceReleaseCandidate(cc);
expect(candidate.version).to.equal('2.0.0');
});
});
});

0 comments on commit dcdc054

Please sign in to comment.