Retrieve every page of repo runner labels
This commit is contained in:
@@ -33,16 +33,20 @@ export async function getRunnerLabels(client: Octokit, cache: TTLCache, owner: s
|
||||
async function fetchRunnerLabels(client: Octokit, owner: string, name: string): Promise<Set<string>> {
|
||||
const labels = new Set<string>();
|
||||
try {
|
||||
const response = await client.actions.listSelfHostedRunnersForRepo({
|
||||
owner,
|
||||
repo: name
|
||||
});
|
||||
const itor = client.paginate.iterator(client.actions.listSelfHostedRunnersForRepo,
|
||||
{
|
||||
owner,
|
||||
repo: name,
|
||||
per_page: 100
|
||||
});
|
||||
|
||||
for (const runner of response.data.runners) {
|
||||
for (const label of runner.labels) {
|
||||
labels.add(label.name);
|
||||
for await (const response of itor) {
|
||||
for (const runner of response.data) {
|
||||
for (const label of runner.labels) {
|
||||
labels.add(label.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("Failure to retrieve runner labels: ", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user