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
This commit is contained in:
parent
c9b36f9150
commit
96dd78e0c6
|
@ -68,5 +68,6 @@ async function isCommitClosingPullRequest(api: GitClient, sha: string, id: numbe
|
||||||
const {data} = await api.github.repos.getCommit({...api.remoteParams, ref: sha});
|
const {data} = await api.github.repos.getCommit({...api.remoteParams, ref: sha});
|
||||||
// Matches the closing keyword supported in commit messages. See:
|
// 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.
|
// 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'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue