Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

wip button to sync new app name

peaklabs-dev737e81aa38f8
diff --git a/app/Livewire/Source/Github/Change.php b/app/Livewire/Source/Github/Change.php
index 5d57ecf1eb..55ced1e3ec 100644
--- a/app/Livewire/Source/Github/Change.php
+++ b/app/Livewire/Source/Github/Change.php
@@ -154,16 +154,26 @@ class Change extends Component
$github_access_token = generate_github_installation_token($this->github_app);
$response = Http::withToken($github_access_token)
- ->get("{$this->github_app->api_url}/app");
+ ->withHeaders([
+ 'Accept' => 'application/vnd.github+json',
+ 'X-GitHub-Api-Version' => '2022-11-28',
+ ])
+ ->get("{$this->github_app->api_url}/installation/repositories");
if ($response->successful()) {
$app_data = $response->json();
- if ($app_data['name'] !== $this->github_app->name) {
- $this->github_app->name = $app_data['name'];
+ $app_name = data_get($app_data, 'installation.app_slug');
+
+ if ($app_name && $app_name !== $this->github_app->name) {
+ $this->github_app->name = $app_name;
+ $this->name = str($app_name)->kebab();
$this->github_app->save();
- $this->name = str($this->github_app->name)->kebab();
- $this->dispatch('success', 'Github App name synchronized.');
+ $this->dispatch('success', 'Github App name synchronized successfully.');
+ } else {
+ $this->dispatch('info', 'Github App name is already up to date.');
}
+ } else {
+ $this->dispatch('error', 'Failed to fetch Github App information. Status: '.$response->status());
}
} catch (\Throwable $e) {
return handleError($e, $this);
diff --git a/resources/views/livewire/source/github/change.blade.php b/resources/views/livewire/source/github/change.blade.php
index 215c544119..2d873b4654 100644
--- a/resources/views/livewire/source/github/change.blade.php
+++ b/resources/views/livewire/source/github/change.blade.php
@@ -60,6 +60,7 @@
<div class="flex gap-2">
<div class="flex items-end gap-2 w-full">
<x-forms.input id="github_app.name" label="App Name" disabled />
+ <x-forms.button wire:click.prevent="syncGithubAppName">Sync Name</x-forms.button>
<a href="{{ $this->getUpdatePath() }}">
<x-forms.button>
Update