From 96dd78e0c625e0dade5b20271a9db406fee6d0d0 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Mon, 12 Oct 2020 21:22:33 +0300 Subject: [PATCH] fix(dev-infra): detect all commit message keywords that can close a PR (#39229) Previously, the `isCommitClosingPullRequest()` method (used in `ng-dev release` to detect whether a commit is closing a PR based on keywords found in the commit message) was only able to detect a subset of the keywords supported by GitHub. This is fine currently, because the merge script adds `PR Close #XYZ` when merging a PR, but it might break in the future. This commit makes the code more robust by ensuring the method can detect all keywords supported by GitHub for automatically closing a PR based on a commit message. Original discussion: https://github.com/angular/angular/pull/39135#discussion_r503440973 PR Close #39229 --- dev-infra/release/publish/pull-request-state.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev-infra/release/publish/pull-request-state.ts b/dev-infra/release/publish/pull-request-state.ts index 437e6cdcb7..9f318ee406 100644 --- a/dev-infra/release/publish/pull-request-state.ts +++ b/dev-infra/release/publish/pull-request-state.ts @@ -68,5 +68,6 @@ 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}(?!\\d)`, 'i')); + return data.commit.message.match( + new RegExp(`(?:close[sd]?|fix(?:e[sd]?)|resolve[sd]?):? #${id}(?!\\d)`, 'i')); }