@@ -15,29 +15,35 @@ export const getIssueList = async (owner: string, repo: string, token: string |
1515 const octokit = new github . GitHub ( token )
1616 const issueState : Issue_state = open ? 'open' : 'all'
1717 // const labelFilter: string = replicate.BOUNTY_LABELS.join(',')
18- const issues = await octokit . issues . listForRepo ( {
19- owner,
20- repo,
21- state : issueState ,
22- per_page : per_page ? per_page : 100 // TODO: implement proper pagination
23- // labels: labelFilter -- Does not work properly
24- } )
25-
26- issues . data . forEach ( issue => {
27- const bountyLabel = checkBountyLabels ? issue . labels . some ( label => {
28- return replicate . BOUNTY_LABELS . includes ( label . name as replicate . BountyType )
29- } ) : undefined
30- if ( ! checkBountyLabels || bountyLabel ) {
31- let item : Issue_info = {
32- title : issue . title ,
33- author : issue . user ?. login ,
34- body : issue . body ? issue . body : '' ,
35- number : issue . number ,
36- html_url : issue . html_url
18+ const issuesPerPage = per_page ? per_page : 50
19+ let pageNb = 0
20+ do {
21+ const issues = await octokit . issues . listForRepo ( {
22+ owner,
23+ repo,
24+ state : issueState ,
25+ per_page : issuesPerPage ,
26+ page : pageNb
27+ // labels: labelFilter -- Does not work properly
28+ } )
29+
30+ issues . data . forEach ( issue => {
31+ const bountyLabel = checkBountyLabels ? issue . labels . some ( label => {
32+ return replicate . BOUNTY_LABELS . includes ( label . name as replicate . BountyType )
33+ } ) : undefined
34+ if ( ! checkBountyLabels || bountyLabel ) {
35+ let item : Issue_info = {
36+ title : issue . title ,
37+ author : issue . user ?. login ,
38+ body : issue . body ? issue . body : '' ,
39+ number : issue . number ,
40+ html_url : issue . html_url
41+ }
42+ result . push ( item )
3743 }
38- result . push ( item )
39- }
40- } ) ;
44+ } ) ;
45+ pageNb = ( issues . data . length < issuesPerPage ) ? - 1 : pageNb + 1
46+ } while ( pageNb >= 0 )
4147 return result
4248 } catch ( error ) {
4349 core . debug ( error . message )
0 commit comments