Fixed githook for reals

This commit is contained in:
Ubergeek 2019-03-21 14:49:58 +00:00
parent a8e5cca79e
commit c3fb5646d5
1 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@
/* gitea deploy webhook */ /* gitea deploy webhook */
/* security and environment*/ /* security */
$access_token = '1234567890'; $access_token = '1234567890';
$ansible_lastrun = '/dev/shm/ansible-hook-last-run'; $ansible_lastrun = '/dev/shm/ansible-hook-last-run';
$ansible_dropfile = '/dev/shm/run-ansible'; $ansible_dropfile = '/dev/shm/run-ansible';
@ -34,7 +34,7 @@ if ($remoteip !== $allowedip)
//* if you need get full json input */ //* if you need get full json input */
//fwrite($fs, 'DATA: '.print_r($data, true).PHP_EOL); //fwrite($fs, 'DATA: '.print_r($data, true).PHP_EOL);
if ($data["repository"]["full_name"] == 'thunix/www') { if ($data["repository"]["full_name"] == 'thunix/ansible') {
syslog(LOG_INFO, 'Ansible Webhook recieved.'); syslog(LOG_INFO, 'Ansible Webhook recieved.');
if ( time () - filemtime ( $ansible_lastrun ) > $ratelimit ) { if ( time () - filemtime ( $ansible_lastrun ) > $ratelimit ) {
touch ( $ansible_dropfile ); touch ( $ansible_dropfile );
@ -49,7 +49,7 @@ if ($data["repository"]["full_name"] == 'thunix/www') {
} }
elseif ($data["repository"]["full_name"] == 'thunix/www') { elseif ($data["repository"]["full_name"] == 'thunix/www') {
syslog(LOG_INFO, 'WWW Webhook recieved.'); syslog(LOG_INFO, 'WWW Webhook recieved.');
if ( time () - filemtime ( $www_lastrun ) > $ratelimit ) { if ( time () - filemtime ( $lastrun ) > $ratelimit ) {
touch ( $www_dropfile ); touch ( $www_dropfile );
touch ( $www_lastrun ); touch ( $www_lastrun );
http_response_code(200); http_response_code(200);