Skip to content

Commit b94b508

Browse files
authored
Merge pull request #7 from bakerkretzmar/check-quick-deploy-before-setting
Silence error if quick deploy is already enabled
2 parents c2f30fb + 9269853 commit b94b508

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

app/Sync/DeploymentScriptSync.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Sync;
44

55
use Illuminate\Console\OutputStyle;
6+
use Laravel\Forge\Exceptions\ValidationException;
67
use Laravel\Forge\Resources\Server;
78
use Laravel\Forge\Resources\Site;
89
use Laravel\Forge\Resources\Webhook;
@@ -16,14 +17,20 @@ public function sync(string $environment, Server $server, Site $site, OutputStyl
1617
$deploymentScriptOnForge = $this->forge->siteDeploymentScript($server->id, $site->id);
1718

1819
if (!$force && $deploymentScript !== $deploymentScriptOnForge) {
19-
$output->warning("Skipping the deployment log update, as the script on Forge is different than your local script.\nUse --force to overwrite it.");
20+
$output->warning("Skipping the deployment script update, as the script on Forge is different than your local script.\nUse --force to overwrite it.");
2021
return;
2122
}
2223

2324
$this->forge->updateSiteDeploymentScript($server->id, $site->id, $deploymentScript);
2425

2526
if ($this->config->get($environment, 'quick-deploy')) {
26-
$site->enableQuickDeploy();
27+
try {
28+
$site->enableQuickDeploy();
29+
} catch (ValidationException $e) {
30+
if (! in_array('Hook already exists on this repository', $e->errors())) {
31+
throw $e;
32+
}
33+
}
2734
} else {
2835
$site->disableQuickDeploy();
2936
}

0 commit comments

Comments
 (0)