Skip to content

Commit c0bb2ff

Browse files
committed
Switch to GitHub's JSON payload
GitHub now supports delivering a pure JSON payload which is much cleaner.
1 parent 03a09ce commit c0bb2ff

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

GitAutoDeploy.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,9 @@ def do_POST(self):
5353
def parseRequest(self):
5454
length = int(self.headers.getheader('content-length'))
5555
body = self.rfile.read(length)
56-
post = urlparse.parse_qs(body)
57-
items = []
58-
for itemString in post['payload']:
59-
item = json.loads(itemString)
60-
items.append(item['repository']['url'])
61-
return items
56+
payload = json.loads(body)
57+
self.branch = payload['ref']
58+
return [payload['repository']['url']]
6259

6360
def getMatchingPaths(self, repoUrl):
6461
res = []

README.textile

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ To set it up, do the following:
1313
* to run it as a daemon add ==--daemon-mode==
1414
* On the Github page go to a repository, then "Admin", "Service Hooks",
1515
"Post-Receive URLs" and add the url of your machine + port (e.g. http://example.com:8001).
16+
* Specify Content type as application/json
1617

1718
You can even test the whole thing here, by clicking on the "Test Hook" button, whohoo!
1819

0 commit comments

Comments
 (0)