-
Notifications
You must be signed in to change notification settings - Fork 1
Github Hook Examples
Bryan Kendall edited this page Jun 24, 2014
·
3 revisions
When you first create the hook for a push
event, it send the following request to test (a ping
event):
POST /
headers { host: 'upbris.bryankendall.me:3000',
accept: '*/*',
'user-agent': 'GitHub Hookshot 3e70583',
'x-github-event': 'ping',
'x-github-delivery': 'e05eb1f2-fbc7-11e3-8e1d-423f213c5718',
'content-type': 'application/json',
'content-length': '529' }
body { zen: 'Encourage flow.',
hook:
{ url: 'https://api.github.com/repos/bkendall/flaming-octo-nemesis/hooks/2472869',
test_url: 'https://api.github.com/repos/bkendall/flaming-octo-nemesis/hooks/2472869/test',
id: 2472869,
name: 'web',
active: true,
events: [ 'push' ],
config:
{ secret: '',
url: 'http://upbris.bryankendall.me:3000/push',
content_type: 'json',
insecure_ssl: '0' },
last_response: { code: null, status: 'unused', message: null },
updated_at: '2014-06-24T17:49:23Z',
created_at: '2014-06-24T17:49:23Z' },
hook_id: 2472869 }
An actual push
event looks like this (this is a first commit):
POST /
headers { host: 'upbris.bryankendall.me:3000',
accept: '*/*',
'user-agent': 'GitHub Hookshot 2636b5a',
'x-github-event': 'push',
'x-github-delivery': '763c374e-fbc8-11e3-9918-1e687924f7ff',
'content-type': 'application/json',
'content-length': '1681' }
body {
"ref":"refs/heads/master",
"after":"7caa8452a30d2ff0e27e82e43b411ec7e42e2238",
"before":"d5455d9c4fa4c43b3dfdc88e446bb1ec4903fd90",
"created":false,
"deleted":false,
"forced":false,
"compare":"https://github.com/bkendall/flaming-octo-nemesis/compare/d5455d9c4fa4...7caa8452a30d",
"commits":[
{
"id":"7caa8452a30d2ff0e27e82e43b411ec7e42e2238",
"distinct":true,
"message":"updating readme",
"timestamp":"2014-06-24T11:54:07-07:00",
"url":"https://github.com/bkendall/flaming-octo-nemesis/commit/7caa8452a30d2ff0e27e82e43b411ec7e42e2238",
"author":{
"name":"Bryan Kendall",
"email":"[email protected]",
"username":"bkendall"
},
"committer":{
"name":"Bryan Kendall",
"email":"[email protected]",
"username":"bkendall"
},
"added":[
],
"removed":[
],
"modified":[
"README.md"
]
}
],
"head_commit":{
"id":"7caa8452a30d2ff0e27e82e43b411ec7e42e2238",
"distinct":true,
"message":"updating readme",
"timestamp":"2014-06-24T11:54:07-07:00",
"url":"https://github.com/bkendall/flaming-octo-nemesis/commit/7caa8452a30d2ff0e27e82e43b411ec7e42e2238",
"author":{
"name":"Bryan Kendall",
"email":"[email protected]",
"username":"bkendall"
},
"committer":{
"name":"Bryan Kendall",
"email":"[email protected]",
"username":"bkendall"
},
"added":[
],
"removed":[
],
"modified":[
"README.md"
]
},
"repository":{
"id":21174769,
"name":"flaming-octo-nemesis",
"url":"https://github.com/bkendall/flaming-octo-nemesis",
"description":"",
"watchers":0,
"stargazers":0,
"forks":0,
"fork":false,
"size":0,
"owner":{
"name":"bkendall",
"email":"[email protected]"
},
"private":false,
"open_issues":0,
"has_issues":true,
"has_downloads":true,
"has_wiki":true,
"created_at":1403632014,
"pushed_at":1403636051,
"master_branch":"master"
},
"pusher":{
"name":"bkendall",
"email":"[email protected]"
}
}