mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 22:46:16 +00:00
Merge (#127)
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user