@@ -125,6 +125,40 @@ describe("Required Labels", () => {
125125
126126 await action ( ) ;
127127 } ) ;
128+
129+ it ( "fetches all label pages from the API" , async ( ) => {
130+ restoreTest = mockPr ( {
131+ INPUT_LABELS : "enhancement" ,
132+ INPUT_MODE : "minimum" ,
133+ INPUT_COUNT : "1" ,
134+ GITHUB_TOKEN : "mock-token-here-abc" ,
135+ } ) ;
136+
137+ // First page of labels
138+ nock ( "https://api.github.com" )
139+ . get ( "/repos/mheap/missing-repo/issues/28/labels" )
140+ . reply ( 200 , [ { name : "triage" } ] , {
141+ Link : '<https://api.github.com/repos/mheap/missing-repo/issues/28/labels?page=2>; rel="next"' ,
142+ } ) ;
143+
144+ // Second page of labels
145+ nock ( "https://api.github.com" )
146+ . get ( "/repos/mheap/missing-repo/issues/28/labels" )
147+ . query ( { page : 2 } )
148+ . reply ( 200 , [ { name : "bug" } ] , {
149+ Link : '<https://api.github.com/repos/mheap/missing-repo/issues/28/labels?page=3>; rel="next"' ,
150+ } ) ;
151+
152+ // Third page of labels
153+ nock ( "https://api.github.com" )
154+ . get ( "/repos/mheap/missing-repo/issues/28/labels" )
155+ . query ( { page : 3 } )
156+ . reply ( 200 , [ { name : "enhancement" } ] ) ;
157+
158+ await action ( ) ;
159+ expect ( core . setOutput ) . toBeCalledWith ( "labels" , "enhancement" ) ;
160+ expect ( core . setOutput ) . toBeCalledWith ( "status" , "success" ) ;
161+ } ) ;
128162 } ) ;
129163
130164 describe ( "success" , ( ) => {
0 commit comments