feat: installation/update github apps

This commit is contained in:
Andras Bacsai
2023-05-09 11:33:50 +02:00
parent db92dc3636
commit 19ad184cd6
20 changed files with 179 additions and 35 deletions

View File

@@ -16,6 +16,7 @@ class GithubPrivateRepository extends Component
public $github_apps;
public GithubApp $github_app;
public $parameters;
public $type;
public int $selected_repository_id;
public string $selected_repository_owner;
@@ -110,8 +111,16 @@ class GithubPrivateRepository extends Component
public function submit()
{
try {
$project = Project::where('uuid', $this->parameters['project_uuid'])->first();
$environment = $project->load(['environments'])->environments->where('name', $this->parameters['environment_name'])->first();
if ($this->type === 'project') {
$project = Project::create([
'name' => generateRandomName(),
'team_id' => session('currentTeam')->id
]);
$environment = $project->load(['environments'])->environments->first();
} else {
$project = Project::where('uuid', $this->parameters['project_uuid'])->first();
$environment = $project->load(['environments'])->environments->where('name', $this->parameters['environment_name'])->first();
}
$application = Application::create([
'name' => "{$this->selected_repository_owner}/{$this->selected_repository_repo}:{$this->selected_branch_name}",
'git_repository' => "{$this->selected_repository_owner}/{$this->selected_repository_repo}",
@@ -130,7 +139,7 @@ class GithubPrivateRepository extends Component
'environment_name' => $environment->name
]);
} catch (\Exception $e) {
return generalErrorHandlerLivewire($e, $this);
return generalErrorHandler($e, $this);
}
}
public function mount()