Created
February 26, 2013 14:36
-
-
Save crumina/5038838 to your computer and use it in GitHub Desktop.
test
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 | |
// Turn off error reporting | |
error_reporting(0); | |
try | |
{ | |
// Decode the payload json string | |
$payload = json_decode($_REQUEST['payload']); | |
} | |
catch(Exception $e) | |
{ | |
exit; | |
} | |
// Pushed to master? | |
if ($payload->ref === 'refs/heads/master') | |
{ | |
// Log the payload object | |
@file_put_contents('logs/github.txt', print_r($payload, TRUE), FILE_APPEND); | |
// Prep the URL - replace https protocol with git protocol to prevent 'update-server-info' errors | |
$url = str_replace('https://', 'git://', $payload->repository->url); | |
// Run the build script as a background process | |
exec(`./build.sh {$url} {$payload->repository->name} > /dev/null 2>&1 &`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment