Skip to content

Instantly share code, notes, and snippets.

@ibourgeois
Last active December 16, 2015 22:57
Show Gist options
  • Save ibourgeois/b3ac73ad6e9ae60e86c4 to your computer and use it in GitHub Desktop.
Save ibourgeois/b3ac73ad6e9ae60e86c4 to your computer and use it in GitHub Desktop.
GitHub PHP Webhooks
<?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>
@ibourgeois
Copy link
Author

create webhook to http://yourdomain.com/path/to/deploy.php with push trigger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment