Skip to content

Commit 60346b5

Browse files
committed
Do not request reviewers for fork-triggered PRs, just mention them
1 parent 73616c9 commit 60346b5

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

scripts/open-user-pr.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ function padNum(number: number) {
1818
}
1919

2020
const userName = process.env.GH_USERNAME;
21-
const reviewers = ["weswigham", "sandersn", "RyanCavanaugh"];
22-
if (process.env.requesting_user && reviewers.indexOf(process.env.requesting_user) === -1) {
23-
reviewers.push(process.env.requesting_user);
24-
}
21+
const reviewers = process.env.requesting_user ? [process.env.requesting_user] : ["weswigham", "sandersn", "RyanCavanaugh"];
2522
const now = new Date();
2623
const branchName = `user-update-${process.env.TARGET_FORK}-${now.getFullYear()}${padNum(now.getMonth())}${padNum(now.getDay())}${process.env.TARGET_BRANCH ? "-" + process.env.TARGET_BRANCH : ""}`;
2724
const remoteUrl = `https://${process.argv[2]}@github.com/${userName}/TypeScript.git`;
@@ -55,13 +52,15 @@ cc ${reviewers.map(r => "@" + r).join(" ")}`,
5552
}).then(async r => {
5653
const num = r.data.number;
5754
console.log(`Pull request ${num} created.`);
58-
await gh.pulls.createReviewRequest({
59-
owner: process.env.TARGET_FORK,
60-
repo: "TypeScript",
61-
number: num,
62-
reviewers,
63-
});
64-
if (process.env.source_issue) {
55+
if (!process.env.source_issue) {
56+
await gh.pulls.createReviewRequest({
57+
owner: process.env.TARGET_FORK,
58+
repo: "TypeScript",
59+
number: num,
60+
reviewers,
61+
});
62+
}
63+
else {
6564
await gh.issues.createComment({
6665
number: +process.env.source_issue,
6766
owner: "Microsoft",

0 commit comments

Comments
 (0)