#129 - Collect GitHub issues with pagination.

This commit is contained in:
Mark Paluch
2019-10-30 13:22:55 +01:00
parent 6f770237ad
commit 0efe1d7a84

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2018 the original author or authors.
* Copyright 2014-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -519,9 +519,14 @@ class GitHub implements IssueTracker {
private Stream<GitHubIssue> getForIssues(String template, Map<String, Object> parameters) {
return operations
.exchange(template, HttpMethod.GET, new HttpEntity<>(newUserScopedHttpHeaders()), ISSUES_TYPE, parameters)
.getBody().stream();
List<GitHubIssue> issues = new ArrayList<>();
doWithPaging(template, HttpMethod.GET, parameters, new HttpEntity<>(newUserScopedHttpHeaders()), ISSUES_TYPE,
tickets -> {
issues.addAll(tickets);
return true;
});
return issues.stream();
}
private Milestone getMilestone(ModuleIteration moduleIteration, String repositoryName) {