#591 - source-controls

This commit is contained in:
Saeed Vaziry
2025-05-18 23:46:28 +02:00
parent 1ed5d7362b
commit 5a00d35eba
19 changed files with 791 additions and 362 deletions

View File

@ -26,16 +26,6 @@ public function createData(array $input): array
];
}
public function editRules(array $input): array
{
return $this->createRules($input);
}
public function editData(array $input): array
{
return $this->createData($input);
}
public function data(): array
{
// support for older data

View File

@ -29,12 +29,15 @@ public function createRules(array $input): array
public function connect(): bool
{
try {
ds($this->getApiUrl());
$res = Http::withToken($this->data()['token'])
->get($this->getApiUrl().'/projects');
->get($this->getApiUrl().'/version');
} catch (Exception) {
return false;
}
ds($res->status());
return $res->successful();
}

View File

@ -2,6 +2,7 @@
namespace App\SourceControlProviders;
use App\Exceptions\FailedToDeployGitHook;
use App\Exceptions\FailedToDeployGitKey;
use App\Exceptions\FailedToDestroyGitHook;
@ -19,18 +20,6 @@ public function createRules(array $input): array;
*/
public function createData(array $input): array;
/**
* @param array<string, mixed> $input
* @return array<string, mixed>
*/
public function editRules(array $input): array;
/**
* @param array<string, mixed> $input
* @return array<string, mixed>
*/
public function editData(array $input): array;
/**
* @return array<string, mixed>
*/
@ -43,10 +32,10 @@ public function getRepo(string $repo): mixed;
public function fullRepoUrl(string $repo, string $key): string;
/**
* @param array<mixed> $events
* @param array<int, mixed> $events
* @return array<string, mixed>
*
* @throws \App\Exceptions\FailedToDeployGitHook
* @throws FailedToDeployGitHook
*/
public function deployHook(string $repo, array $events, string $secret): array;
@ -56,7 +45,7 @@ public function deployHook(string $repo, array $events, string $secret): array;
public function destroyHook(string $repo, string $hookId): void;
/**
* @return array<string, mixed>
* @return array<string, mixed>|null
*/
public function getLastCommit(string $repo, string $branch): ?array;