Add deploy webhook for auto-deploy from Forgejo
This commit is contained in:
parent
1f81d98c52
commit
906f1408fa
1 changed files with 16 additions and 0 deletions
16
_webhook/deploy.php
Normal file
16
_webhook/deploy.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$secret = 'payfrit-deploy-2026';
|
||||
$headerSecret = $_SERVER['HTTP_X_FORGEJO_SIGNATURE'] ?? $_GET['secret'] ?? '';
|
||||
|
||||
if ($headerSecret !== $secret) {
|
||||
http_response_code(403);
|
||||
echo json_encode(['OK' => false, 'ERROR' => 'unauthorized']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$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')]);
|
||||
Loading…
Add table
Reference in a new issue