fix(dev-infra): correctly check for commit that closes PR (#39135)

The `ng-dev release publish` command needs to check whether a commit
closed a pull request. This is implemented via checking the commit
message for specific closing keywords referencing the pull request
number.

The regex used previously failed to correctly ensure that the specified
pull request was referenced. For example, it would allow `#12345` to
also match for `#1234`.

This commit fixes the regex.

PR Close #39135
This commit is contained in:
George Kalpakas 2020-10-10 22:02:48 +03:00 committed by atscott
parent 6947ceaf44
commit c76dda6aeb
1 changed files with 1 additions and 1 deletions

View File

@ -68,5 +68,5 @@ async function isCommitClosingPullRequest(api: GitClient, sha: string, id: numbe
const {data} = await api.github.repos.getCommit({...api.remoteParams, ref: sha});
// Matches the closing keyword supported in commit messages. See:
// https://docs.github.com/en/enterprise/2.16/user/github/managing-your-work-on-github/closing-issues-using-keywords.
return data.commit.message.match(new RegExp(`close[sd]? #${id}[^0-9]?`, 'i'));
return data.commit.message.match(new RegExp(`close[sd]? #${id}(?!\\d)`, 'i'));
}