Skip to content

Instantly share code, notes, and snippets.

@PuercoPop
Last active December 28, 2015 11:09
Show Gist options
  • Save PuercoPop/7491302 to your computer and use it in GitHub Desktop.
Save PuercoPop/7491302 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
import subprocess
from flask import Flask, request
PROJECT_ROOT = ""
app = Flask(__name__)
@app.route('/', methods=['POST'])
def pull():
"""Verify that the request is from Github, then do a pull request
interactive.
"""
if request.headers.get('X-Github-Event') == "push":
process = subprocess.Popen(['git', 'pull', '--rebase', 'origin', 'master'],
cwd=PROJECT_ROOT, )
else:
print "Empty Payload"
if __name__ == "__main__":
app.run("0.0.0.0", 7373)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment