Last active
December 21, 2015 15:28
-
-
Save rohmann/6326472 to your computer and use it in GitHub Desktop.
Simple script for use with GitHub web hooks
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 | |
//Only allow requests from Github (see: https://gist.github.com/webtekk/6326465) | |
if (!githubOrigin()) die('Unauthorized'); | |
$data = json_decode($_POST['payload'],true); | |
//Only continue if this commit is on the master branch | |
if (!$data['ref'] == 'refs/heads/master') die('Not a master branch commit'); | |
//Pass the repo name and URL through to our shell script (see: https://gist.github.com/webtekk/6326294) | |
shell_exec('cd '.dirname(__FILE__).'; ./gitarchivemaster.sh '.$data['repository']['url'].' '.$data['repository']['name']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment