Update scripts for octokit 17 (#36915)

* Update scripts for octokit 17

Also put playwright in alphabetical order, npm seems to like that.

* back to passing auth in the ctor I GUESS
This commit is contained in:
Nathan Shively-Sanders 2020-02-21 09:49:02 -08:00 committed by GitHub
parent 24dd93fc2b
commit a5061eff19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 35 deletions

View file

@ -87,6 +87,7 @@
"mocha-fivemat-progress-reporter": "latest",
"ms": "latest",
"node-fetch": "^2.6.0",
"playwright": "latest",
"plugin-error": "latest",
"pretty-hrtime": "^1.0.3",
"prex": "^0.4.3",
@ -96,7 +97,6 @@
"through2": "latest",
"travis-fold": "latest",
"typescript": "next",
"playwright": "latest",
"vinyl": "latest",
"vinyl-sourcemaps-apply": "latest",
"xml2js": "^0.4.19"

View file

@ -27,10 +27,8 @@ async function main() {
["git", ["log", "-1", `--pretty="%aN <%aE>"`]]
]);
const gh = new Octokit();
gh.authenticate({
type: "token",
token: process.argv[2]
const gh = new Octokit({
auth: process.argv[2]
});
const inputPR = (await gh.pulls.get({ pull_number: +process.env.SOURCE_ISSUE, owner: "microsoft", repo: "TypeScript" })).data;
@ -101,7 +99,7 @@ cc ${reviewers.map(r => "@" + r).join(" ")}`,
console.log(`Pull request ${num} created.`);
await gh.issues.createComment({
number: +process.env.SOURCE_ISSUE,
issue_number: +process.env.SOURCE_ISSUE,
owner: "Microsoft",
repo: "TypeScript",
body: `Hey @${process.env.REQUESTING_USER}, I've opened #${num} for you.`
@ -112,13 +110,11 @@ main().catch(async e => {
console.error(e);
process.exitCode = 1;
if (process.env.SOURCE_ISSUE) {
const gh = new Octokit();
gh.authenticate({
type: "token",
token: process.argv[2]
const gh = new Octokit({
auth: process.argv[2]
});
await gh.issues.createComment({
number: +process.env.SOURCE_ISSUE,
issue_number: +process.env.SOURCE_ISSUE,
owner: "Microsoft",
repo: "TypeScript",
body: `Hey @${process.env.REQUESTING_USER}, I couldn't open a PR with the cherry-pick. ([You can check the log here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary)). You may need to squash and pick this PR into ${process.env.TARGET_BRANCH} manually.`

View file

@ -1,7 +1,7 @@
/// <reference lib="esnext.asynciterable" />
/// <reference lib="es2015.promise" />
// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally
import Octokit = require("@octokit/rest");
import { Octokit } from "@octokit/rest";
import {runSequence} from "./run-sequence";
function padNum(num: number) {
@ -24,10 +24,8 @@ runSequence([
["git", ["push", "--set-upstream", "fork", branchName, "-f"]] // push the branch
]);
const gh = new Octokit();
gh.authenticate({
type: "token",
token: process.argv[2]
const gh = new Octokit({
auth: process.argv[2]
});
gh.pulls.create({
owner: process.env.TARGET_FORK!,
@ -54,7 +52,7 @@ cc ${reviewers.map(r => "@" + r).join(" ")}`,
}
else {
await gh.issues.createComment({
number: +process.env.SOURCE_ISSUE,
issue_number: +process.env.SOURCE_ISSUE,
owner: "Microsoft",
repo: "TypeScript",
body: `The user suite test run you requested has finished and _failed_. I've opened a [PR with the baseline diff from master](${r.data.html_url}).`

View file

@ -1,7 +1,7 @@
// @ts-check
/// <reference lib="esnext.asynciterable" />
// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally
const Octokit = require("@octokit/rest");
const { Octokit } = require("@octokit/rest");
const fs = require("fs");
const requester = process.env.requesting_user;
@ -12,13 +12,11 @@ const outputTableText = fs.readFileSync(process.argv[3], { encoding: "utf8" });
console.log(`Fragment contents:
${outputTableText}`);
const gh = new Octokit();
gh.authenticate({
type: "token",
token: process.argv[2]
const gh = new Octokit({
auth: process.argv[2]
});
gh.issues.createComment({
number: +source,
issue_number: +source,
owner: "Microsoft",
repo: "TypeScript",
body: `@${requester}

View file

@ -1,7 +1,7 @@
// @ts-check
/// <reference lib="esnext.asynciterable" />
// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally
const Octokit = require("@octokit/rest");
const { Octokit } = require("@octokit/rest");
const ado = require("azure-devops-node-api");
const { default: fetch } = require("node-fetch");
@ -23,10 +23,8 @@ async function main() {
const tgzUrl = new URL(artifact.resource.url);
tgzUrl.search = `artifactName=tgz&fileId=${file.blob.id}&fileName=${file.path}`;
const link = "" + tgzUrl;
const gh = new Octokit();
gh.authenticate({
type: "token",
token: process.argv[2]
const gh = new Octokit({
auth: process.argv[2]
});
// Please keep the strings "an installable tgz" and "packed" in this message, as well as the devDependencies section,
@ -57,13 +55,11 @@ main().catch(async e => {
console.error(e);
process.exitCode = 1;
if (process.env.SOURCE_ISSUE) {
const gh = new Octokit();
gh.authenticate({
type: "token",
token: process.argv[2]
const gh = new Octokit({
auth: process.argv[2]
});
await gh.issues.createComment({
number: +process.env.SOURCE_ISSUE,
issue_number: +process.env.SOURCE_ISSUE,
owner: "Microsoft",
repo: "TypeScript",
body: `Hey @${process.env.REQUESTING_USER}, something went wrong when looking for the build artifact. ([You can check the log here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary)).`

View file

@ -1,6 +1,6 @@
// @ts-check
/// <reference lib="esnext.asynciterable" />
const Octokit = require("@octokit/rest");
const { Octokit } = require("@octokit/rest");
const { runSequence } = require("./run-sequence");
// The first is used by bot-based kickoffs, the second by automatic triggers
@ -76,7 +76,8 @@ async function main() {
]);
// Merge each branch into `experimental` (which, if there is a conflict, we now know is from inter-experiment conflict)
for (const branch of prnums) {
for (const branchnum of prnums) {
const branch = "" + branchnum;
// Find the merge base
const mergeBase = runSequence([
["git", ["merge-base", branch, "experimental"]],