Fix deploy webhook to do git pull directly + add phpcheck diagnostic
This commit is contained in:
parent
eb033b6d4f
commit
41aba807b4
1 changed files with 13 additions and 1 deletions
|
|
@ -10,7 +10,19 @@ if ($headerSecret !== $secret) {
|
||||||
exit;
|
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';
|
$triggerFile = '/tmp/deploy-payfrit-api.trigger';
|
||||||
file_put_contents($triggerFile, date('Y-m-d H:i:s'));
|
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')
|
||||||
|
]);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue