Skip to content

Update scripts for octokit 17 #36915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 21, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -96,7 +97,6 @@
"through2": "latest",
"travis-fold": "latest",
"typescript": "next",
"playwright": "latest",
"vinyl": "latest",
"vinyl-sourcemaps-apply": "latest",
"xml2js": "^0.4.19"
Expand Down
4 changes: 2 additions & 2 deletions scripts/open-cherry-pick-pr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,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.`
Expand All @@ -118,7 +118,7 @@ main().catch(async e => {
token: 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.`
Expand Down
4 changes: 2 additions & 2 deletions scripts/open-user-pr.ts
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down Expand Up @@ -54,7 +54,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}).`
Expand Down
4 changes: 2 additions & 2 deletions scripts/perf-result-post.js
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -18,7 +18,7 @@ gh.authenticate({
token: process.argv[2]
});
gh.issues.createComment({
number: +source,
issue_number: +source,
owner: "Microsoft",
repo: "TypeScript",
body: `@${requester}
Expand Down
4 changes: 2 additions & 2 deletions scripts/post-vsts-artifact-comment.js
Original file line number Diff line number Diff line change
@@ -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");

Expand Down Expand Up @@ -63,7 +63,7 @@ main().catch(async e => {
token: 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)).`
Expand Down
5 changes: 3 additions & 2 deletions scripts/update-experimental-branches.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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"]],
Expand Down