build: remove deprecated node-github api (#12420)

Switches to the newer version of `node-github` that has been renamed to `@octokit/rest`.
This commit is contained in:
Paul Gschwendtner
2018-07-31 20:13:34 +02:00
committed by Jeremy Elbourn
parent f5f7f1c3d1
commit 73f3f940b0
3 changed files with 64 additions and 59 deletions
+51 -46
View File
@@ -919,6 +919,39 @@
"integrity": "sha512-LAQ1d4OPfSJ/BMbI2DuizmYrrkD9JMaTdi2hQTlI53lQ4kRQPyZQRS4CYQ7O66bnBBnP/oYdRxbk++X0xuFU6A==",
"dev": true
},
"@octokit/rest": {
"version": "15.9.4",
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-15.9.4.tgz",
"integrity": "sha512-v3CS1qW4IjriMvGgm4lDnYFBJlkwvzIbTxiipOcwVP8xeK8ih2pJofRhk7enmLngTtNEa+sIApJNkXxyyDKqLg==",
"dev": true,
"requires": {
"before-after-hook": "^1.1.0",
"btoa-lite": "^1.0.0",
"debug": "^3.1.0",
"http-proxy-agent": "^2.1.0",
"https-proxy-agent": "^2.2.0",
"lodash": "^4.17.4",
"node-fetch": "^2.1.1",
"url-template": "^2.0.8"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"dev": true,
"requires": {
"ms": "2.0.0"
}
},
"node-fetch": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.2.0.tgz",
"integrity": "sha512-OayFWziIxiHY8bCUyLX6sTpDH8Jsbp4FfYd1j1f7vZyfgkcOnAyM4oQR16f8a0s7Gl/viMGRey8eScYk4V4EZA==",
"dev": true
}
}
},
"@protobufjs/aspromise": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
@@ -1946,6 +1979,12 @@
"integrity": "sha1-5tXqjF2tABMEpwsiY4RH9pyy+Ak=",
"dev": true
},
"before-after-hook": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-1.1.0.tgz",
"integrity": "sha512-VOMDtYPwLbIncTxNoSzRyvaMxtXmLWLUqr8k5AfC1BzLk34HvBXaQX8snOwQZ4c0aX8aSERqtJSiI9/m2u5kuA==",
"dev": true
},
"better-assert": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz",
@@ -2205,6 +2244,12 @@
}
}
},
"btoa-lite": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz",
"integrity": "sha1-M3dm2hWAEhD92VbCLpxokaudAzc=",
"dev": true
},
"buffer": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.1.0.tgz",
@@ -4365,12 +4410,6 @@
"is-obj": "^1.0.0"
}
},
"dotenv": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-4.0.0.tgz",
"integrity": "sha1-hk7xN5rO1Vzm+V3r7NzhefegzR0=",
"dev": true
},
"double-ended-queue": {
"version": "2.1.0-0",
"resolved": "https://registry.npmjs.org/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz",
@@ -6962,40 +7001,6 @@
"ini": "^1.3.2"
}
},
"github": {
"version": "12.1.0",
"resolved": "https://registry.npmjs.org/github/-/github-12.1.0.tgz",
"integrity": "sha512-HhWjhd/OATC4Hjj7xfGjGRtwWzo/fzTc55EkvsRatI9G6Vp47mVcdBIt1lQ56A9Qit/yVQRX1+M9jbWlcJvgug==",
"dev": true,
"requires": {
"dotenv": "^4.0.0",
"follow-redirects": "1.2.6",
"https-proxy-agent": "^2.1.0",
"lodash": "^4.17.4",
"mime": "^2.0.3",
"netrc": "^0.1.4"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"dev": true,
"requires": {
"ms": "2.0.0"
}
},
"follow-redirects": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.2.6.tgz",
"integrity": "sha512-FrMqZ/FONtHnbqO651UPpfRUVukIEwJhXMfdr/JWAmrDbeYBu773b1J6gdWDyRIj4hvvzQEHoEOTrdR8o6KLYA==",
"dev": true,
"requires": {
"debug": "^3.1.0"
}
}
}
},
"glob": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
@@ -13028,12 +13033,6 @@
"dev": true,
"optional": true
},
"netrc": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/netrc/-/netrc-0.1.4.tgz",
"integrity": "sha1-a+lPysqNd63gqWcNxGCRTJRHJEQ=",
"dev": true
},
"next-tick": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz",
@@ -19312,6 +19311,12 @@
"prepend-http": "^2.0.0"
}
},
"url-template": {
"version": "2.0.8",
"resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz",
"integrity": "sha1-/FZaPMy/93MMd19WQflVV5FDnyE=",
"dev": true
},
"url-to-options": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz",
+1 -1
View File
@@ -53,6 +53,7 @@
"@angular/upgrade": "6.0.0",
"@bazel/ibazel": "0.3.1",
"@google-cloud/storage": "^1.1.1",
"@octokit/rest": "^15.9.4",
"@schematics/angular": "^0.7.1",
"@types/chalk": "^0.4.31",
"@types/fs-extra": "^4.0.3",
@@ -75,7 +76,6 @@
"firebase-tools": "^3.11.0",
"fs-extra": "^3.0.1",
"git-semver-tags": "^2.0.0",
"github": "^12.0.3",
"glob": "^7.1.2",
"google-closure-compiler": "20170409.0.0",
"gulp": "^3.9.1",
+12 -12
View File
@@ -2,7 +2,7 @@
const path = require('path');
const fs = require('fs');
const GitHubApi = require('github');
const GitHubApi = require('@octokit/rest');
const github = new GitHubApi();
@@ -30,6 +30,14 @@ const intervalMinutes = 10;
/** Instead of querying github for PR numbers, manually provide the PR numbers to be presubmit */
const explicitPullRequests = [];
/** Options that will be passed to the octokit Github API when querying Github for PR numbers. */
const githubSearchOptions = {
// Use the maximum of allowed items per Github API query. 100 pull requests should be
// enough to continuously run presubmits through night.
per_page: 100,
q: 'repo:angular/material2 is:open type:pr label:"pr: merge ready" -label:"pr: merge safe"',
};
/** END OF CONFIGURATION. */
@@ -41,17 +49,9 @@ if (explicitPullRequests.length) {
writeScheduleScript(explicitPullRequests.map(n => ({number: n})));
} else {
// Fetch PRs that are merge-ready but not merge-safe
github.search.issues({
per_page: 100,
q: 'repo:angular/material2 is:open type:pr label:"pr: merge ready" -label:"pr: merge safe"',
}, (error, response) => {
if (response) {
writeScheduleScript(response.data.items);
} else {
console.error('Fetching merge-ready PRs failed.');
console.error(error);
}
});
github.search.issues(githubSearchOptions)
.then(response => writeScheduleScript(response.data.items))
.catch(error => console.error('Fetching merge-ready PRs failed.', error));
}