Skip to content

Commit f61567b

Browse files
committed
Per_page fix
1 parent ce6a660 commit f61567b

File tree

4 files changed

+7
-13
lines changed

4 files changed

+7
-13
lines changed

config/packages/github_api.yaml

+2-6
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,17 @@ services:
4343

4444
Github\Api\Issue\Comments:
4545
factory: ['@Github\Api\Issue', comments]
46-
calls:
47-
- ['setPerPage', [100]]
4846

4947
Github\Api\Issue\Labels:
5048
factory: ['@Github\Api\Issue', labels]
51-
calls:
52-
- ['setPerPage', [100]]
5349

5450
Github\Api\Issue\Milestones:
5551
factory: ['@Github\Api\Issue', milestones]
5652

5753
Github\Api\Issue\Timeline:
5854
factory: ['@Github\Api\Issue', timeline]
55+
calls:
56+
- [configure]
5957

6058
Github\Api\PullRequest:
6159
factory: ['@Github\Client', api]
@@ -71,5 +69,3 @@ services:
7169
Github\Api\Search:
7270
factory: ['@Github\Client', api]
7371
arguments: [search]
74-
calls:
75-
- ['setPerPage', [100]]

phpunit.xml.dist

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
<ini name="error_reporting" value="-1"/>
1111
<server name="APP_ENV" value="test" force="true"/>
1212
<server name="SHELL_VERBOSITY" value="-1"/>
13-
<server name="SYMFONY_PHPUNIT_REMOVE" value=""/>
14-
<server name="SYMFONY_PHPUNIT_VERSION" value="7.5"/>
1513
</php>
1614
<testsuites>
1715
<testsuite name="Unit">

src/Api/Issue/GithubIssueApi.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function open(Repository $repository, string $title, string $body, array
3838
];
3939

4040
$issueNumber = null;
41-
$existingIssues = $this->searchApi->issues(sprintf('repo:%s "%s" is:open author:%s', $repository->getFullName(), $title, $this->botUsername));
41+
$existingIssues = $this->searchApi->issues(sprintf('repo:%s "%s" is:open author:%s', $repository->getFullName(), $title, $this->botUsername), 'updated', 'desc', ['per_page'=>100]);
4242
foreach ($existingIssues['items'] ?? [] as $issue) {
4343
$issueNumber = $issue['number'];
4444
}
@@ -53,7 +53,7 @@ public function open(Repository $repository, string $title, string $body, array
5353

5454
public function lastCommentWasMadeByBot(Repository $repository, $number): bool
5555
{
56-
$allComments = $this->issueCommentApi->all($repository->getVendor(), $repository->getName(), $number);
56+
$allComments = $this->issueCommentApi->all($repository->getVendor(), $repository->getName(), $number, ['per_page' => 100]);
5757
$lastComment = $allComments[count($allComments) - 1] ?? [];
5858

5959
return $this->botUsername === ($lastComment['user']['login'] ?? null);
@@ -74,7 +74,7 @@ public function hasActivity(Repository $repository, $number): bool
7474
$reviewComments = [];
7575
}
7676

77-
$all = array_merge($reviewComments, $this->issueCommentApi->all($repository->getVendor(), $repository->getName(), $number));
77+
$all = array_merge($reviewComments, $this->issueCommentApi->all($repository->getVendor(), $repository->getName(), $number, ['per_page' => 100]));
7878
foreach ($all as $comment) {
7979
if (!in_array($comment['user']['login'], [$author, $this->botUsername])) {
8080
return true;
@@ -109,7 +109,7 @@ public function commentOnIssue(Repository $repository, $issueNumber, string $com
109109

110110
public function findStaleIssues(Repository $repository, \DateTimeImmutable $noUpdateAfter): array
111111
{
112-
$issues = $this->searchApi->issues(sprintf('repo:%s is:issue -label:"Keep open" is:open updated:<%s', $repository->getFullName(), $noUpdateAfter->format('Y-m-d')));
112+
$issues = $this->searchApi->issues(sprintf('repo:%s is:issue -label:"Keep open" is:open updated:<%s', $repository->getFullName(), $noUpdateAfter->format('Y-m-d')), 'updated', 'desc', ['per_page'=>100]);
113113

114114
return $issues['items'] ?? [];
115115
}

src/Api/PullRequest/GithubPullRequestApi.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function findReviewer(Repository $repository, $number, string $type)
4949

5050
public function getAuthorCount(Repository $repository, string $author): int
5151
{
52-
$result = $this->search->issues(sprintf('is:pr repo:%s author:%s', $repository->getFullName(), $author));
52+
$result = $this->search->issues(sprintf('is:pr repo:%s author:%s', $repository->getFullName(), $author), 'updated', 'desc', ['per_page'=>100]);
5353

5454
return $result['total_count'];
5555
}

0 commit comments

Comments
 (0)