From c76dda6aebce5fe8f0dafdb0c5266ef4db1226b2 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Sat, 10 Oct 2020 22:02:48 +0300 Subject: [PATCH] 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 --- dev-infra/release/publish/pull-request-state.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-infra/release/publish/pull-request-state.ts b/dev-infra/release/publish/pull-request-state.ts index cd750ff672..437e6cdcb7 100644 --- a/dev-infra/release/publish/pull-request-state.ts +++ b/dev-infra/release/publish/pull-request-state.ts @@ -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')); }