You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/v3/repos/hooks.md
+52-10Lines changed: 52 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,30 @@ The Repository Hooks API manages the post-receive web and service hooks
8
8
for a repository. There are two main APIs to manage these hooks: a JSON
9
9
HTTP API, and [PubSubHubbub](#pubsubhubbub).
10
10
11
+
Active hooks can be configured to trigger for one or more events.
12
+
The default event is `push`. The available events are:
13
+
14
+
*`push` - Any git push to a Repository.
15
+
*`issues` - Any time an Issue is opened or closed.
16
+
*`issue_comment` - Any time an Issue is commented on.
17
+
*`commit_comment` - Any time a Commit is commented on.
18
+
*`pull_request` - Any time a Pull Request is opend, closed, or
19
+
synchronized (updated due to a new push in the branch that the pull
20
+
request is tracking).
21
+
*`gollum` - Any time a Wiki page is updated.
22
+
*`watch` - Any time a User watches the Repository.
23
+
*`download` - Any time a Download is added to the Repository.
24
+
*`fork` - Any time a Repository is forked.
25
+
*`fork_apply` - Any time a patch is applied to the Repository from the
26
+
Fork Queue.
27
+
*`member` - Any time a User is added as a collaborator to a
28
+
non-Organization Repository.
29
+
*`public` - Any time a Repository changes from private to public.
30
+
31
+
For a Hook to go through, the Hook needs to be configured to trigger for
32
+
an event, and the Service has to listen to it. The Services are all
33
+
part of the open source [github-services](https://github.com/github/github-services) project.Most of the Services only listen for `push` events. However, the generic [Web Service](https://github.com/github/github-services/blob/master/services/web.rb) listens for all events. Other services like the [IRC Service](https://github.com/github/github-services/blob/master/services/irc.rb) may only listen for `push`, `issues`, and `pull_request` events.
34
+
11
35
## List
12
36
13
37
GET /repos/:user/:repo/hooks
@@ -24,7 +48,7 @@ HTTP API, and [PubSubHubbub](#pubsubhubbub).
24
48
### Response
25
49
26
50
<%= headers 200 %>
27
-
<%= json :full_hook %>
51
+
<%= json :hook %>
28
52
29
53
## Create a hook
30
54
@@ -42,24 +66,26 @@ settings for this hook. These settings vary between the services and
: _Optional_**array** - Determines what events the hook is triggered
109
+
for. This replaces the entire array of events. Default: `["push"]`.
110
+
111
+
add_events
112
+
: _Optional_**array** - Determines a list of events to be added to the
113
+
list of events that the Hook triggers for.
114
+
115
+
remove_events
116
+
: _Optional_**array** - Determines a list of events to be removed from the
117
+
list of events that the Hook triggers for.
118
+
80
119
active
81
120
: _Optional_**boolean** - Determines whether the hook is actually
82
121
triggered on pushes.
@@ -93,7 +132,7 @@ triggered on pushes.
93
132
### Response
94
133
95
134
<%= headers 200 %>
96
-
<%= json :full_hook %>
135
+
<%= json :hook %>
97
136
98
137
## Test a hook
99
138
@@ -118,7 +157,10 @@ repository.
118
157
119
158
GitHub can also serve as a [PubSubHubbub][pubsub] hub for all repositories. PSHB is a simple publish/subscribe protocol that lets servers register to receive updates when a topic is updated. The updates are sent with an HTTP POST request to a callback URL. Topic URLs for a GitHub repository's pushes are in this format:
120
159
121
-
https://github.com/:user/:repo/events/push
160
+
https://github.com/:user/:repo/events/:event
161
+
162
+
The event can be any Event string that is listed at the top of this
163
+
document.
122
164
123
165
The default format is what [existing post-receive hooks should
124
166
expect][post-receive]: A JSON body sent as the `payload` parameter in a
@@ -156,7 +198,7 @@ hub.mode
156
198
157
199
hub.topic
158
200
: _Required_**string** - The URI of the GitHub repository to subscribe
159
-
to. The path must be in the format of `/:user/:repo/events/push`.
201
+
to. The path must be in the format of `/:user/:repo/events/:event`.
160
202
161
203
hub.callback
162
204
: _Required_**string** - The URI to receive the updates to the topic.
0 commit comments