-
Couldn't load subscription status.
- Fork 87
Github BranchService only returns 1 page of results #152
Description
metrik/backend/src/main/kotlin/metrik/project/domain/service/githubactions/BranchService.kt
Lines 25 to 33 in 2182a17
| val branches = with(githubFeignClient) { | |
| getOwnerRepoFromUrl(pipeline.url).let { (owner, repo) -> | |
| retrieveBranches( | |
| pipeline.credential, | |
| owner, | |
| repo, | |
| ) | |
| } | |
| } |
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.
metrik/backend/src/main/kotlin/metrik/project/domain/service/githubactions/PipelineRunService.kt
Lines 17 to 22 in 2182a17
| fun getNewRuns(pipeline: PipelineConfiguration, emitCb: (SyncProgress) -> Unit): MutableList<GithubActionsRun> { | |
| val latestTimestamp = getLatestBuildTimeStamp(pipeline) | |
| val newRuns = runService.syncRunsByPage(pipeline, latestTimestamp, emitCb) | |
| val branches = branchService.retrieveBranches(pipeline) | |
| return newRuns.filter { branches.contains(it.branch) } as MutableList<GithubActionsRun> | |
| } |
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: