Skip to content

Instantly share code, notes, and snippets.

@normanlolx
Forked from cowboy/github_post_recieve.php
Last active November 6, 2018 14:43
Show Gist options
  • Select an option

  • Save normanlolx/91411e5494f5e04e000a7cf28df95447 to your computer and use it in GitHub Desktop.

Select an option

Save normanlolx/91411e5494f5e04e000a7cf28df95447 to your computer and use it in GitHub Desktop.
PHP webhook to pull and Gulp build automatically after push
<?php
// Use in the "Post-Receive URLs" section of your GitHub repo.
if ( $_POST['payload'] ) {
shell_exec( 'cd /srv/www/git-repo/ && git reset --hard HEAD && git pull' );
}
?>hi
@normanlolx
Copy link
Author

normanlolx commented Jul 3, 2017

/etc/sudoers:

www-data ALL = (myuser) NOPASSWD: /usr/bin/git
www-data ALL = (myuser) NOPASSWD: /usr/bin/node
www-data ALL = (myuser) NOPASSWD: /usr/bin/drush
www-data ALL = (myuser) NOPASSWD: /usr/bin/whoami

@adibnoh
Copy link

adibnoh commented Nov 6, 2018

Thanks man! this works!

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