77ce1a33 by Jeff Balicki

test

1 parent 0bd804aa
1 <?php 1 <?php
2 #webhook.php
3 echo "working<br/>";
4 2
5 $cmd = shell_exec("git pull 2>&1");
6 3
7 #for debugging 4 // Set Variables
8 echo $cmd; 5 $LOCAL_ROOT = "/var/www/html/";
6 $LOCAL_REPO_NAME = "banners-with-skip";
7 $LOCAL_REPO = "{$LOCAL_ROOT}/{$LOCAL_REPO_NAME}";
8 $REMOTE_REPO = "git@git.gotenzing.com:jeffmbalicki/banners-with-skip.git";
9 $BRANCH = "deploy";
10
11 if ( $_POST['payload'] ) {
12 // Only respond to POST requests from Github
13
14 if( file_exists($LOCAL_REPO) ) {
15
16 // If there is already a repo, just run a git pull to grab the latest changes
17 shell_exec("cd {$LOCAL_REPO} && git pull");
18
19 die("done " . mktime());
20 } else {
21
22 // If the repo does not exist, then clone it into the parent directory
23 shell_exec("cd {$LOCAL_ROOT} && git clone {$REMOTE_REPO}");
24
25 die("done " . mktime());
26 }
27 }
9 28
10 die("<br/>done " . mktime());
11 ?> 29 ?>
......