Fix deprecation warnings in experiment sync script

This commit is contained in:
Wesley Wigham 2019-06-05 15:25:33 -07:00
parent 16030663ff
commit bddcf10eb8
No known key found for this signature in database
GPG Key ID: D59F87F60C5400C9

View File

@ -34,23 +34,21 @@ async function main() {
["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork
]);
const gh = new Octokit();
gh.authenticate({
type: "token",
token: process.argv[2]
const gh = new Octokit({
auth: process.argv[2]
});
for (const numRaw of prnums) {
const num = +numRaw;
if (num) {
// PR number rather than branch name - lookup info
const inputPR = await gh.pulls.get({ owner: "Microsoft", repo: "TypeScript", number: num });
const inputPR = await gh.pulls.get({ owner: "Microsoft", repo: "TypeScript", pull_number: num });
// GH calculates the rebaseable-ness of a PR into its target, so we can just use that here
if (!inputPR.data.rebaseable) {
if (+triggeredPR === num) {
await gh.issues.createComment({
owner: "Microsoft",
repo: "TypeScript",
number: num,
issue_number: num,
body: `This PR is configured as an experiment, and currently has merge conflicts with master - please rebase onto master and fix the conflicts.`
});
throw new Error(`Merge conflict detected in PR ${num} with master`);