Skip to content

Commit fb34ba7

Browse files
committed
fixed public repo failed to get tag without token (token not needed for public repos)
1 parent 2b0cf96 commit fb34ba7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Services/GitHubService.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,15 @@ public function getLatestTag(?string $repository = null): string
8383
protected function fetchLatestTag(string $repository): ?string
8484
{
8585
try {
86-
$response = Http::withToken($this->token)
86+
$response = Http::when(config('filament-easy-footer.github.token'),fn ($request) => $request->withToken($this->token))
8787
->get("https://api.github.com/repos/{$repository}/releases/latest");
8888

89+
8990
if ($response->successful()) {
9091
return $response->json('tag_name');
9192
}
9293

93-
$tagsResponse = Http::withToken($this->token)
94+
$tagsResponse = Http::when(config('filament-easy-footer.github.token'),fn ($request) => $request->withToken($this->token))
9495
->get("https://api.github.com/repos/{$repository}/tags");
9596

9697
if ($tagsResponse->successful() && ! empty($tagsResponse->json())) {

0 commit comments

Comments
 (0)