Last active
December 16, 2015 22:57
-
-
Save ibourgeois/b3ac73ad6e9ae60e86c4 to your computer and use it in GitHub Desktop.
GitHub PHP Webhooks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$path = '/var/www/repo'; | |
$status = 'Not Successful'; | |
if ( $_SERVER[ 'HTTP_X_GITHUB_EVENT' ] == 'push' || $_POST[ 'payload' ] ) | |
{ | |
shell_exec( 'cd ' . $path . ' && git reset --hard HEAD && git pull' ); | |
$status = 'Successful'; | |
} | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Deploy Status: <?php echo $status; ?></title> | |
</head> | |
<body> | |
<br /> | |
<br /> | |
<center> | |
<h1>Deploy Status: <?php echo $status; ?></h1> | |
</center> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
create webhook to
http://yourdomain.com/path/to/deploy.php
withpush
trigger.