input('secret')) { abort(404); } /** @var GitHook $gitHook */ $gitHook = GitHook::query() ->where('secret', $request->input('secret')) ->firstOrFail(); foreach ($gitHook->actions as $action) { if ($action == 'deploy') { try { app(Deploy::class)->run($gitHook->site); } catch (SourceControlIsNotConnected) { Notifier::send($gitHook->sourceControl, new SourceControlDisconnected($gitHook->sourceControl)); } catch (Throwable $e) { ServerLog::log( $gitHook->site->server, 'deploy-failed', $e->getMessage(), $gitHook->site ); Log::error('git-hook-exception', (array) $e); } } } return response()->json([ 'success' => true, ]); } }