refactor: Use callback for octokit conversion

This commit is contained in:
Thomas A. Christensen II 2024-01-25 22:12:49 -06:00
parent 251e9bd445
commit 7473a3926d

View file

@ -52,24 +52,19 @@ export async function setup_octokit(
} }
export async function pull_releases( export async function pull_releases(
octokit: InstanceType<typeof GitHub>
): Promise<NextflowRelease[]> {
const all_release_data: object[] = await all_nf_release_data(octokit)
const all_releases: NextflowRelease[] = []
for (const data of all_release_data) {
all_releases.push(nextflow_release(data))
}
return all_releases
}
export async function all_nf_release_data(
ok: InstanceType<typeof GitHub> ok: InstanceType<typeof GitHub>
): Promise<object[]> { ): Promise<NextflowRelease[]> {
return await ok.paginate( return await ok.paginate(
ok.rest.repos.listReleases, ok.rest.repos.listReleases,
NEXTFLOW_REPO, NEXTFLOW_REPO,
response => response.data response => {
const all_releases: NextflowRelease[] = []
const releases_data = response.data
for (const release_data of releases_data) {
all_releases.push(nextflow_release(release_data))
}
return all_releases
}
) )
} }