Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Github webhook PHP script
<?php
try {
// Decode JSON data from Github
$payload = json_decode($_REQUEST['payload']);
}
catch(Exception $e) {
exit(0);
}
// Deploy live if push was on master branch
if ($payload->ref === 'refs/heads/master') {
exec('./deploy-master.sh');
}
// Deploy staging if push was on stage branch
if ($payload->ref === 'refs/heads/stage') {
exec('./deploy-stage.sh');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.