Skip to content

Commit 962e94b

Browse files
authored
Update getAllGithubLabelNames to paginate label retrieval
Refactor getAllGithubLabelNames to use pagination for fetching labels.
1 parent 9f9ae6c commit 962e94b

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

src/githubHelper.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,16 @@ export class GithubHelper {
230230
try {
231231
await utils.sleep(this.delayInMs);
232232
// get an array of GitHub labels for the new repo
233-
let result = await this.githubApi.issues.listLabelsForRepo({
234-
owner: this.githubOwner,
235-
repo: this.githubRepo,
236-
});
237-
238-
// extract the label name and put into a new array
239-
let labels = result.data.map(x => x.name);
233+
const labels = await this.githubApi.paginate(
234+
this.githubApi.issues.listLabelsForRepo,
235+
{
236+
owner: this.githubOwner,
237+
repo: this.githubRepo,
238+
per_page: 100,
239+
},
240+
// extract the label name and put into a new array
241+
response => response.data.map(label => label.name)
242+
);
240243

241244
return labels;
242245
} catch (err) {

0 commit comments

Comments
 (0)