Skip to content

Commit

Permalink
Retrieve all labels through pagination (#71)
Browse files Browse the repository at this point in the history
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max and crazy-max committed Apr 8, 2020
1 parent cd92869 commit 3153b4a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
11 changes: 8 additions & 3 deletions lib/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 11 additions & 7 deletions src/main.ts
Expand Up @@ -160,14 +160,18 @@ async function run() {
}

async function getLiveLabels(): Promise<Array<Label>> {
return (
await octokit.issues.listLabelsForRepo({
...github.context.repo,
mediaType: {
previews: ['symmetra']
}
const res = await octokit.paginate(
octokit.issues.listLabelsForRepo.endpoint.merge({
...github.context.repo
})
).data as Array<Label>;
);
return res.map(label => {
return {
name: label.name,
color: label.color,
description: label.description || ''
};
}) as Array<Label>;
}

async function getFileLabels(yamlFile: fs.PathLike): Promise<Array<Label>> {
Expand Down

0 comments on commit 3153b4a

Please sign in to comment.