-
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: 'd5455d9c4fa4c43b3dfdc88e446bb1ec4903fd90',
before: '0000000000000000000000000000000000000000',
created: true,
deleted: false,
forced: true,
compare: 'https://github.com/bkendall/flaming-octo-nemesis/commit/d5455d9c4fa4',
commits:
[ { id: 'd5455d9c4fa4c43b3dfdc88e446bb1ec4903fd90',
distinct: true,
message: 'adding readme',
timestamp: '2014-06-24T10:47:48-07:00',
url: 'https://github.com/bkendall/flaming-octo-nemesis/commit/d5455d9c4fa4c43b3dfdc88e446bb1ec4903fd90',
author: [Object],
committer: [Object],
added: [Object],
removed: [],
modified: [] } ],
head_commit:
{ id: 'd5455d9c4fa4c43b3dfdc88e446bb1ec4903fd90',
distinct: true,
message: 'adding readme',
timestamp: '2014-06-24T10:47:48-07:00',
url: 'https://github.com/bkendall/flaming-octo-nemesis/commit/d5455d9c4fa4c43b3dfdc88e446bb1ec4903fd90',
author:
{ name: 'Bryan Kendall',
email: '[email protected]',
username: 'bkendall' },
committer:
{ name: 'Bryan Kendall',
email: '[email protected]',
username: 'bkendall' },
added: [ 'README.md' ],
removed: [],
modified: [] },
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: 1403632414,
master_branch: 'master' },
pusher: { name: 'bkendall', email: '[email protected]' } }