Skip to content

Commit

Permalink
Merge pull request #74 from lo1tuma/parentheses-in-pr-titles
Browse files Browse the repository at this point in the history
Support parentheses in PR titles
  • Loading branch information
lo1tuma authored Aug 25, 2016
2 parents ccf2482 + f51be5d commit 64c9158
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/getMergedPullRequests.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function getPullRequests(fromTag) {
return commit.indexOf('Merge pull request') === 0;
})
.map((pullRequest) => {
const pattern = /^Merge pull request #(\d+) from (.*) \((.*)\)/;
const pattern = /^Merge pull request #(\d+) from (.*?) \((.*)\)$/;
const matches = pullRequest.match(pattern);

return {
Expand Down
15 changes: 15 additions & 0 deletions test/unit/lib/getMergedPullRequestsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,19 @@ describe('getMergedPullRequests', function () {
return expect(getMergedPullRequests(anyRepo))
.to.become(expectedResults);
});

it('should work with parentheses in the commit message body', function () {
const gitLogMessages = [
'Merge pull request #42 from A (pr-42 message (fixes #21))'
];

const expectedResults = [
{ id: '42', title: 'pr-42 message (fixes #21)', label: 'bug' }
];

gitLog.resolves(gitLogMessages.join('\n'));

return expect(getMergedPullRequests(anyRepo))
.to.become(expectedResults);
});
});

0 comments on commit 64c9158

Please sign in to comment.