Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/VCS/Adapter/Git/GitHub.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,22 @@ public function createRepository(string $owner, string $repositoryName, bool $pr
*/
public function searchRepositories(string $owner, int $page, int $per_page, string $search = ''): array
{
Comment thread
hmacr marked this conversation as resolved.
Outdated
$url = '/search/repositories';
$url = '/installation/repositories';

$response = $this->call(self::METHOD_GET, $url, ['Authorization' => "Bearer $this->accessToken"], [
'q' => "{$search} user:{$owner} fork:true",
'page' => $page,
'per_page' => $per_page,
'sort' => 'updated'
]);

if (!isset($response['body']['items'])) {
if (!isset($response['body']['repositories'])) {
throw new Exception("Repositories list missing in the response.");
}
Comment thread
hmacr marked this conversation as resolved.

$repositories = array_filter($response['body']['repositories'] ?? [], fn ($repo) => str_contains($repo['name'], $search));
Comment thread
hmacr marked this conversation as resolved.
Outdated

return [
'items' => $response['body']['items'],
'total' => $response['body']['total_count'],
'items' => $repositories,
'total' => \count($repositories),
];
Comment thread
hmacr marked this conversation as resolved.
}

Expand Down
Loading