thoughtworks / metrik

An easy-to-use, cross-platform measurement tool that pulls data out of CD pipelines and analysis the four key metrics for you.
MIT License
354 stars 87 forks source link

Github BranchService only returns 1 page of results #152

Open psigourney opened 1 year ago

psigourney commented 1 year ago

https://github.com/thoughtworks/metrik/blob/2182a17147a64b84ef79bf6071248fd5364761c5/backend/src/main/kotlin/metrik/project/domain/service/githubactions/BranchService.kt#L25-L33

Github API Docs: https://docs.github.com/en/rest/branches/branches#list-branches Based on the GH API, only the first 30 branches will be returned by the BranchService.

https://github.com/thoughtworks/metrik/blob/2182a17147a64b84ef79bf6071248fd5364761c5/backend/src/main/kotlin/metrik/project/domain/service/githubactions/PipelineRunService.kt#L17-L22

I'm not really sure why we're pulling the branches and filtering on them to begin with (if a run was executed on a specific branch, then that branch was later deleted, we'd still want to capture the run, right?), but if the branch filter is required (could someone reply with an explanation?), it might make sense to apply some pagination logic to the BranchService, similar to the logic used in syncRunsByPage:

https://github.com/thoughtworks/metrik/blob/main/backend/src/main/kotlin/metrik/project/domain/service/githubactions/RunService.kt#L19