Fix deploy webhook to do git pull directly + add phpcheck diagnostic

This commit is contained in:
Mike 2026-03-25 03:25:58 +00:00
parent eb033b6d4f
commit 41aba807b4

View file

@ -10,7 +10,19 @@ if ($headerSecret !== $secret) {
exit;
}
// Run git pull directly
$repoPath = dirname(__DIR__);
$output = [];
$exitCode = 0;
exec("cd " . escapeshellarg($repoPath) . " && git pull origin main 2>&1", $output, $exitCode);
// Also write trigger file for backward compatibility
$triggerFile = '/tmp/deploy-payfrit-api.trigger';
file_put_contents($triggerFile, date('Y-m-d H:i:s'));
echo json_encode(['OK' => true, 'MESSAGE' => 'Deploy triggered', 'TIME' => date('c')]);
echo json_encode([
'OK' => $exitCode === 0,
'MESSAGE' => $exitCode === 0 ? 'Deploy successful' : 'Deploy failed',
'OUTPUT' => implode("\n", $output),
'TIME' => date('c')
]);