File tree Expand file tree Collapse file tree 1 file changed +24
-8
lines changed
Expand file tree Collapse file tree 1 file changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -147,15 +147,31 @@ export class GithubHelper {
147147 */
148148 async getAllGithubMilestones ( ) : Promise < SimpleMilestone [ ] > {
149149 try {
150- await utils . sleep ( this . delayInMs ) ;
151- // get an array of GitHub milestones for the new repo
152- let result = await this . githubApi . issues . listMilestones ( {
153- owner : this . githubOwner ,
154- repo : this . githubRepo ,
155- state : 'all' ,
156- } ) ;
150+ let allMilestones : SimpleMilestone [ ] = [ ] ;
151+ let page = 1 ;
152+ const perPage = 100 ;
153+
154+ while ( true ) {
155+ await utils . sleep ( this . delayInMs ) ;
156+ const result = await this . githubApi . issues . listMilestones ( {
157+ owner : this . githubOwner ,
158+ repo : this . githubRepo ,
159+ state : 'all' ,
160+ per_page : perPage ,
161+ page,
162+ } ) ;
163+
164+ if ( result . data . length === 0 ) break ;
165+
166+ allMilestones = allMilestones . concat (
167+ result . data . map ( x => ( { number : x . number , title : x . title } ) ) ,
168+ ) ;
169+
170+ if ( result . data . length < perPage ) break ;
171+ page ++ ;
172+ }
157173
158- return result . data . map ( x => ( { number : x . number , title : x . title } ) ) ;
174+ return allMilestones ;
159175 } catch ( err ) {
160176 console . error ( 'Could not access all GitHub milestones' ) ;
161177 console . error ( err ) ;
You can’t perform that action at this time.
0 commit comments