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.

fix: comment id should be string fix: do not wait for GH response, stop preview before

Andras Bacsai7f052163e374
diff --git a/app/Http/Controllers/Webhook/Github.php b/app/Http/Controllers/Webhook/Github.php
index bddfaff928..07b573ab69 100644
--- a/app/Http/Controllers/Webhook/Github.php
+++ b/app/Http/Controllers/Webhook/Github.php
@@ -410,11 +410,12 @@ class Github extends Controller
if ($action === 'closed' || $action === 'close') {
$found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
if ($found) {
- ApplicationPullRequestUpdateJob::dispatchSync(application: $application, preview: $found, status: ProcessStatus::CLOSED);
- $found->delete();
$container_name = generateApplicationContainerName($application, $pull_request_id);
- // ray('Stopping container: ' . $container_name);
instant_remote_process(["docker rm -f $container_name"], $application->destination->server);
+
+ ApplicationPullRequestUpdateJob::dispatchSync(application: $application, preview: $found, status: ProcessStatus::CLOSED);
+ $found->delete();
+
$return_payloads->push([
'application' => $application->name,
'status' => 'success',
@@ -430,7 +431,6 @@ class Github extends Controller
}
}
}
- ray($return_payloads);
return response($return_payloads);
} catch (Exception $e) {
ray($e->getMessage());
diff --git a/app/Jobs/ApplicationPullRequestUpdateJob.php b/app/Jobs/ApplicationPullRequestUpdateJob.php
index 74f7a7b674..0aedd99a81 100755
--- a/app/Jobs/ApplicationPullRequestUpdateJob.php
+++ b/app/Jobs/ApplicationPullRequestUpdateJob.php
@@ -31,6 +31,7 @@ class ApplicationPullRequestUpdateJob implements ShouldQueue, ShouldBeEncrypted
{
try {
if ($this->application->is_public_repository()) {
+ ray('Public repository. Skipping comment update.');
return;
}
if ($this->status === ProcessStatus::CLOSED) {
@@ -59,7 +60,7 @@ class ApplicationPullRequestUpdateJob implements ShouldQueue, ShouldBeEncrypted
}
} catch (\Throwable $e) {
ray($e);
- throw $e;
+ return $e;
}
}
diff --git a/database/migrations/2024_06_06_103938_change_pr_issue_commend_id_type.php b/database/migrations/2024_06_06_103938_change_pr_issue_commend_id_type.php
new file mode 100644
index 0000000000..c7d71203b8
--- /dev/null
+++ b/database/migrations/2024_06_06_103938_change_pr_issue_commend_id_type.php
@@ -0,0 +1,28 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+ /**
+ * Run the migrations.
+ */
+ public function up(): void
+ {
+ Schema::table('application_previews', function (Blueprint $table) {
+ $table->string('pull_request_issue_comment_id')->nullable()->change();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('application_previews', function (Blueprint $table) {
+ $table->integer('pull_request_issue_comment_id')->nullable()->change();
+ });
+ }
+};