diff --git a/app/Models/Application.php b/app/Models/Application.php
index 422e4abd7..36cacf1dc 100644
--- a/app/Models/Application.php
+++ b/app/Models/Application.php
@@ -135,4 +135,11 @@ class Application extends BaseModel
{
return Activity::where('subject_id', $this->id)->where('properties->type_uuid', '=', $deployment_uuid)->first();
}
+ public function isDeployable(): bool
+ {
+ if ($this->settings->is_auto_deploy) {
+ return true;
+ }
+ return false;
+ }
}
diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.php
index 9f2d549a3..e76e899f8 100644
--- a/resources/views/livewire/project/application/general.blade.php
+++ b/resources/views/livewire/project/application/general.blade.php
@@ -49,7 +49,7 @@
label="Git Submodules Allowed?" />
-
+
diff --git a/routes/webhooks.php b/routes/webhooks.php
index 25d4d4f1d..cd1a9d5cd 100644
--- a/routes/webhooks.php
+++ b/routes/webhooks.php
@@ -95,16 +95,18 @@ Route::post('/source/github/events', function () {
}
$applications = Application::where('project_id', $id)->where('git_branch', $branch)->get();
foreach ($applications as $application) {
- GithubEventsApplications::create([
- "delivery_guid" => $x_github_delivery,
- "application_id" => $application->id
- ]);
- $deployment_uuid = new Cuid2(7);
- dispatch(new DeployApplicationJob(
- deployment_uuid: $deployment_uuid,
- application_uuid: $application->uuid,
- force_rebuild: false,
- ));
+ if ($application->isDeployable()) {
+ GithubEventsApplications::create([
+ "delivery_guid" => $x_github_delivery,
+ "application_id" => $application->id
+ ]);
+ $deployment_uuid = new Cuid2(7);
+ dispatch(new DeployApplicationJob(
+ deployment_uuid: $deployment_uuid,
+ application_uuid: $application->uuid,
+ force_rebuild: false,
+ ));
+ }
}
} catch (\Exception $e) {
return generalErrorHandler($e);