2
2
3
3
const path = require ( 'path' ) ;
4
4
const fs = require ( 'fs' ) ;
5
- const GitHubApi = require ( 'github ' ) ;
5
+ const GitHubApi = require ( '@octokit/rest ' ) ;
6
6
const github = new GitHubApi ( ) ;
7
7
8
8
@@ -30,6 +30,14 @@ const intervalMinutes = 10;
30
30
/** Instead of querying github for PR numbers, manually provide the PR numbers to be presubmit */
31
31
const explicitPullRequests = [ ] ;
32
32
33
+ /** Options that will be passed to the octokit Github API when querying Github for PR numbers. */
34
+ const githubSearchOptions = {
35
+ // Use the maximum of allowed items per Github API query. 100 pull requests should be
36
+ // enough to continuously run presubmits through night.
37
+ per_page : 100 ,
38
+ q : 'repo:angular/material2 is:open type:pr label:"pr: merge ready" -label:"pr: merge safe"' ,
39
+ } ;
40
+
33
41
/** END OF CONFIGURATION. */
34
42
35
43
@@ -41,17 +49,9 @@ if (explicitPullRequests.length) {
41
49
writeScheduleScript ( explicitPullRequests . map ( n => ( { number : n } ) ) ) ;
42
50
} else {
43
51
// Fetch PRs that are merge-ready but not merge-safe
44
- github . search . issues ( {
45
- per_page : 100 ,
46
- q : 'repo:angular/material2 is:open type:pr label:"pr: merge ready" -label:"pr: merge safe"' ,
47
- } , ( error , response ) => {
48
- if ( response ) {
49
- writeScheduleScript ( response . data . items ) ;
50
- } else {
51
- console . error ( 'Fetching merge-ready PRs failed.' ) ;
52
- console . error ( error ) ;
53
- }
54
- } ) ;
52
+ github . search . issues ( githubSearchOptions )
53
+ . then ( response => writeScheduleScript ( response . data . items ) )
54
+ . catch ( error => console . error ( 'Fetching merge-ready PRs failed.' , error ) ) ;
55
55
}
56
56
57
57
0 commit comments