77ce1a33 by Jeff Balicki

test

1 parent 0bd804aa
<?php
#webhook.php
echo "working<br/>";
$cmd = shell_exec("git pull 2>&1");
#for debugging
echo $cmd;
// Set Variables
$LOCAL_ROOT = "/var/www/html/";
$LOCAL_REPO_NAME = "banners-with-skip";
$LOCAL_REPO = "{$LOCAL_ROOT}/{$LOCAL_REPO_NAME}";
$REMOTE_REPO = "git@git.gotenzing.com:jeffmbalicki/banners-with-skip.git";
$BRANCH = "deploy";
die("<br/>done " . mktime());
?>
\ No newline at end of file
if ( $_POST['payload'] ) {
// Only respond to POST requests from Github
if( file_exists($LOCAL_REPO) ) {
// If there is already a repo, just run a git pull to grab the latest changes
shell_exec("cd {$LOCAL_REPO} && git pull");
die("done " . mktime());
} else {
// If the repo does not exist, then clone it into the parent directory
shell_exec("cd {$LOCAL_ROOT} && git clone {$REMOTE_REPO}");
die("done " . mktime());
}
}
?>
......