Skip to content

Instantly share code, notes, and snippets.

@crumina
Created February 26, 2013 14:36
Show Gist options
  • Save crumina/5038838 to your computer and use it in GitHub Desktop.
Save crumina/5038838 to your computer and use it in GitHub Desktop.
test
<?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