Skip to content

Commit

Permalink
Do not request reviewers for fork-triggered PRs, just mention them
Browse files Browse the repository at this point in the history
  • Loading branch information
weswigham committed Apr 6, 2019
1 parent 73616c9 commit 60346b5
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions scripts/open-user-pr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ function padNum(number: number) {
}

const userName = process.env.GH_USERNAME;
const reviewers = ["weswigham", "sandersn", "RyanCavanaugh"];
if (process.env.requesting_user && reviewers.indexOf(process.env.requesting_user) === -1) {
reviewers.push(process.env.requesting_user);
}
const reviewers = process.env.requesting_user ? [process.env.requesting_user] : ["weswigham", "sandersn", "RyanCavanaugh"];
const now = new Date();
const branchName = `user-update-${process.env.TARGET_FORK}-${now.getFullYear()}${padNum(now.getMonth())}${padNum(now.getDay())}${process.env.TARGET_BRANCH ? "-" + process.env.TARGET_BRANCH : ""}`;
const remoteUrl = `https://${process.argv[2]}@github.com/${userName}/TypeScript.git`;
Expand Down Expand Up @@ -55,13 +52,15 @@ cc ${reviewers.map(r => "@" + r).join(" ")}`,
}).then(async r => {
const num = r.data.number;
console.log(`Pull request ${num} created.`);
await gh.pulls.createReviewRequest({
owner: process.env.TARGET_FORK,
repo: "TypeScript",
number: num,
reviewers,
});
if (process.env.source_issue) {
if (!process.env.source_issue) {
await gh.pulls.createReviewRequest({
owner: process.env.TARGET_FORK,
repo: "TypeScript",
number: num,
reviewers,
});
}
else {
await gh.issues.createComment({
number: +process.env.source_issue,
owner: "Microsoft",
Expand Down

0 comments on commit 60346b5

Please sign in to comment.