Newer
Older
Zirror-API / docroot / git / push.php
@Christopher W. Olsen Christopher W. Olsen on 5 Oct 2018 624 bytes Sync
<?php

/*
 * Update Website When Code Is Pushed
 *
 * When comment is prepended with ! it will not pull the push
 *
 */
if (isset ( $_POST ['payload'] )) {
  $pData = json_decode ( $_POST ['payload'] );

  system ( "echo 'Message: " . $pData->head_commit->message . "' >> /tmp/post.log" );

  if ($pData->head_commit->message [0] != '!') {
    $sLog [0] = system ( "/usr/local/bin/git -C /usr/web/sites/app.zirror.com pull" );

    system ( "echo '[0][" . json_encode ( $sLog ) . "]' >> /tmp/system.log" );

    system ( "echo 'NO ESC' >> /tmp/post.log" );
  } else {
    system ( "echo 'ESC' >> /tmp/post.log" );
  }
}

?>