diff --git a/public_html/webhook.php b/public_html/webhook.php index 4d9fa73..258dc6e 100644 --- a/public_html/webhook.php +++ b/public_html/webhook.php @@ -13,8 +13,8 @@ if (!defined('WEBHOOK_SECRET')) { echo json_encode(['error' => 'Webhook not configured']); exit; } -define('DEPLOY_QUEUE', '/tmp/jarvis-deploy-queue.txt'); -define('DEPLOY_LOG', '/var/www/jarvis/logs/deploy.log'); +define('DEPLOY_QUEUE', '/tmp/jarvis-deploy-queue.txt'); +define('DEPLOY_LOG', '/var/www/jarvis/logs/deploy.log'); header('Content-Type: application/json'); @@ -50,20 +50,9 @@ if (!isset($repoMap[$repo])) { } $path = $repoMap[$repo]; - -// NovaCPX lives on a private VM — the VM polls GitHub every minute via cron -// This webhook receipt confirms GitHub delivered the push notification -if ($path === '__NOVACPX_VM__') { - $commit = $data['after'] ?? 'HEAD'; - $msg = "[" . date('Y-m-d H:i:s') . "] NovaCPX push by $pusher (commit: $commit) — VM will deploy within 1 min"; - file_put_contents(DEPLOY_LOG, $msg . "\n", FILE_APPEND | LOCK_EX); - echo json_encode(['ok' => true, 'queued' => 'novacpx', 'commit' => $commit]); - exit; -} +$ts = date('Y-m-d H:i:s'); file_put_contents(DEPLOY_QUEUE, $path . "\n", FILE_APPEND | LOCK_EX); - -$msg = "[" . date('Y-m-d H:i:s') . "] Queued deploy: $repo by $pusher -> $path"; -file_put_contents(DEPLOY_LOG, $msg . "\n", FILE_APPEND | LOCK_EX); +file_put_contents(DEPLOY_LOG, "[$ts] Queued deploy: $repo by $pusher -> $path\n", FILE_APPEND | LOCK_EX); echo json_encode(['ok' => true, 'queued' => $repo, 'path' => $path]);