From c407306db534f1dd3e73599566177700a7607570 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Sat, 17 Jun 2023 21:15:46 +0200 Subject: [PATCH] fix --- app/Http/Livewire/Source/Github/Change.php | 1 - routes/webhooks.php | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Livewire/Source/Github/Change.php b/app/Http/Livewire/Source/Github/Change.php index b020e0ca4..b2bb9f75a 100644 --- a/app/Http/Livewire/Source/Github/Change.php +++ b/app/Http/Livewire/Source/Github/Change.php @@ -3,7 +3,6 @@ namespace App\Http\Livewire\Source\Github; use App\Models\GithubApp; -use App\Models\InstanceSettings; use Livewire\Component; class Change extends Component diff --git a/routes/webhooks.php b/routes/webhooks.php index 55ec5ec27..803e5190a 100644 --- a/routes/webhooks.php +++ b/routes/webhooks.php @@ -51,6 +51,13 @@ Route::get('/source/github/install', function () { $github_app->installation_id = $installation_id; $github_app->save(); } + // Must check the slug in case the user changes it in the GitHub App settings + $token = generate_github_jwt_token($github_app); + $response = Http::github($github_app->api_url, $token)->get('/app'); + $slug = data_get($response->json(), 'slug'); + $github_app->name = $slug; + $github_app->save(); + return redirect()->route('source.github.show', ['github_app_uuid' => $github_app->uuid]); } catch (\Exception $e) { return general_error_handler(err: $e);