refactor(github): enhance API request handling and validation
- Updated validation rules for 'custom_user' and 'custom_port' fields to be nullable in the GithubController. - Refactored API request handling in GithubController, GithubPrivateRepository, and helper functions to use a consistent Http::GitHub method with timeout and retry logic. - Improved error handling for repository and branch loading processes.
This commit is contained in:
@@ -135,7 +135,13 @@ function getPermissionsPath(GithubApp $source)
|
||||
|
||||
function loadRepositoryByPage(GithubApp $source, string $token, int $page)
|
||||
{
|
||||
$response = Http::withToken($token)->get("{$source->api_url}/installation/repositories?per_page=100&page={$page}");
|
||||
$response = Http::GitHub($source->api_url, $token)
|
||||
->timeout(20)
|
||||
->retry(3, 200, throw: false)
|
||||
->get('/installation/repositories', [
|
||||
'per_page' => 100,
|
||||
'page' => $page,
|
||||
]);
|
||||
$json = $response->json();
|
||||
if ($response->status() !== 200) {
|
||||
return [
|
||||
|
Reference in New Issue
Block a user