From 750915697c659fe69cf7da98d7004cc17e271c88 Mon Sep 17 00:00:00 2001 From: Myron Blair Date: Tue, 23 Jun 2026 17:43:53 +0000 Subject: [PATCH] feat: add auto-deploy webhook handler --- webhook.php | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 webhook.php diff --git a/webhook.php b/webhook.php new file mode 100644 index 0000000..91138af --- /dev/null +++ b/webhook.php @@ -0,0 +1,41 @@ + 'Invalid signature']); + exit; +} + +$data = json_decode($payload, true); +$ref = $data['ref'] ?? ''; +$pusher = $data['pusher']['name'] ?? 'unknown'; + +if ($ref !== 'refs/heads/main') { + echo json_encode(['ok' => true, 'skipped' => "ref $ref is not main"]); + exit; +} + +$ts = date('Y-m-d H:i:s'); +file_put_contents(DEPLOY_QUEUE, REPO_PATH . "\n", FILE_APPEND | LOCK_EX); +file_put_contents(DEPLOY_LOG, "[$ts] Queued deploy by $pusher\n", FILE_APPEND | LOCK_EX); + +echo json_encode(['ok' => true, 'queued' => 'web-dashboard']);