Skip to content

Commit 75f36b9

Browse files
authored
Merge pull request #117 from utopia-php/feat/tag-resolution--2
fix: omit Authorization header in listTags when no access token
2 parents 5f2299e + 6154ecf commit 75f36b9

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/VCS/Adapter/Git/GitHub.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class GitHub extends Git
3232

3333
protected string $endpoint = 'https://api.github.com';
3434

35-
protected string $accessToken;
35+
protected string $accessToken = '';
3636

3737
protected string $jwtToken;
3838

@@ -809,7 +809,8 @@ public function listBranches(string $owner, string $repositoryName, int $perPage
809809
public function listTags(string $owner, string $repositoryName, string $search = ''): array
810810
{
811811
$url = "/repos/$owner/$repositoryName/git/matching-refs/tags/";
812-
$response = $this->call(self::METHOD_GET, $url, ['Authorization' => "Bearer $this->accessToken"]);
812+
$headers = empty($this->accessToken) ? [] : ['Authorization' => "Bearer $this->accessToken"];
813+
$response = $this->call(self::METHOD_GET, $url, $headers);
813814

814815
$statusCode = $response['headers']['status-code'] ?? 0;
815816
$responseBody = $response['body'] ?? [];

0 commit comments

Comments
 (0)