Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
mydnic authored and github-actions[bot] committed Jan 6, 2025
1 parent a07980b commit 0e54263
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/Commands/FetchGithubCommitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ public function fetchCommits(): Collection
$commits = collect();

foreach (config('changelog-commit-for-laravel.github_repositories') as $repository) {
$branch = [
'sha' => '',
'name' => ''
$branch = [
'sha' => '',
'name' => '',
];
if(is_array($repository)){

if (is_array($repository)) {
$branch['sha'] = '?sha='.$repository[1];
$branch['name'] = $repository[1];
$repository = $repository[0];
} else {
$branch['name'] = 'main';
$branch['name'] = 'main';
}

$repoCommits = Http::withHeaders([
Expand All @@ -64,20 +64,21 @@ public function fetchCommits(): Collection
'X-GitHub-Api-Version' => '2022-11-28',
])
->get('https://api.github.com/repos/'.$repository.'/commits'.$branch['sha']);

if(!$repoCommits->successful()){
$this->error("Error while getting commit messages: " . $repoCommits->json()['message']);

if (! $repoCommits->successful()) {
$this->error('Error while getting commit messages: '.$repoCommits->json()['message']);

return collect();
}

foreach ($repoCommits->json() as $commit) {
$commits->push([
'branch' => $branch['name'],
'github' => $commit
'github' => $commit,
]);
}
}

return $commits;
}
}

0 comments on commit 0e54263

Please sign in to comment.