This commit is contained in:
Saeed Vaziry
2024-03-24 09:56:34 +01:00
committed by GitHub
parent 884f18db63
commit 4d051330d6
1055 changed files with 14493 additions and 20278 deletions

View File

@ -16,7 +16,7 @@ public function connect(): bool
{
$res = Http::withHeaders([
'Accept' => 'application/vnd.github.v3+json',
'Authorization' => 'Bearer '.$this->sourceControl->access_token,
'Authorization' => 'Bearer '.$this->data()['token'],
])->get($this->apiUrl.'/user/repos');
return $res->successful();
@ -34,7 +34,7 @@ public function getRepo(?string $repo = null): mixed
}
$res = Http::withHeaders([
'Accept' => 'application/vnd.github.v3+json',
'Authorization' => 'Bearer '.$this->sourceControl->access_token,
'Authorization' => 'Bearer '.$this->data()['token'],
])->get($url);
$this->handleResponseErrors($res, $repo);
@ -54,7 +54,7 @@ public function deployHook(string $repo, array $events, string $secret): array
{
$response = Http::withHeaders([
'Accept' => 'application/vnd.github.v3+json',
'Authorization' => 'Bearer '.$this->sourceControl->access_token,
'Authorization' => 'Bearer '.$this->data()['token'],
])->post($this->apiUrl."/repos/$repo/hooks", [
'name' => 'web',
'events' => $events,
@ -82,7 +82,7 @@ public function destroyHook(string $repo, string $hookId): void
{
$response = Http::withHeaders([
'Accept' => 'application/vnd.github.v3+json',
'Authorization' => 'Bearer '.$this->sourceControl->access_token,
'Authorization' => 'Bearer '.$this->data()['token'],
])->delete($this->apiUrl."/repos/$repo/hooks/$hookId");
if ($response->status() != 204) {
@ -98,7 +98,7 @@ public function getLastCommit(string $repo, string $branch): ?array
$url = $this->apiUrl.'/repos/'.$repo.'/commits/'.$branch;
$res = Http::withHeaders([
'Accept' => 'application/vnd.github.v3+json',
'Authorization' => 'Bearer '.$this->sourceControl->access_token,
'Authorization' => 'Bearer '.$this->data()['token'],
])->get($url);
$this->handleResponseErrors($res, $repo);
@ -124,7 +124,7 @@ public function getLastCommit(string $repo, string $branch): ?array
*/
public function deployKey(string $title, string $repo, string $key): void
{
$response = Http::withToken($this->sourceControl->access_token)->post(
$response = Http::withToken($this->data()['token'])->post(
$this->apiUrl.'/repos/'.$repo.'/keys',
[
'title' => $title,