fix(gitea) : fetch only branch-specific commits using compare API
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -133,17 +133,21 @@ final readonly class GiteaApiService
|
||||
/**
|
||||
* @return array<array{sha: string, commit: array{message: string, author: array}, created: string}>
|
||||
*/
|
||||
public function listCommits(Project $project, string $branch): array
|
||||
public function listBranchCommits(Project $project, string $branch): array
|
||||
{
|
||||
$this->assertProjectHasRepo($project);
|
||||
|
||||
return $this->request('GET', sprintf(
|
||||
'/api/v1/repos/%s/%s/commits',
|
||||
$defaultBranch = $this->getDefaultBranch($project);
|
||||
|
||||
$data = $this->request('GET', sprintf(
|
||||
'/api/v1/repos/%s/%s/compare/%s...%s',
|
||||
$project->getGiteaOwner(),
|
||||
$project->getGiteaRepo(),
|
||||
), [
|
||||
'query' => ['sha' => $branch, 'limit' => 30],
|
||||
]);
|
||||
$defaultBranch,
|
||||
urlencode($branch),
|
||||
));
|
||||
|
||||
return $data['commits'] ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user