Skip to content

Commit 21295b4

Browse files
author
Hubot
committed
Sync changes from upstream repository
1 parent d402485 commit 21295b4

24 files changed

Lines changed: 2917 additions & 25 deletions

content/v3/activity/events/types.md

Lines changed: 48 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Event Types | GitHub API
33
---
44

5-
# Event Types
5+
# Event Types & Payloads
66

77
Each event has a similar JSON schema, but a unique `payload` object that is
88
determined by its event type. [Repository hook](/v3/repos/hooks/) names relate to event types, and will have the exact same payload. The only exception to this is the `push` hook, which has a larger, more detailed payload.
@@ -21,7 +21,7 @@ They're only created for various internal and repository hooks.
2121

2222
Triggered when a [commit comment](/v3/repos/comments/#list-commit-comments-for-a-repository) is created.
2323

24-
### Hook name
24+
### Event name
2525

2626
`commit_comment`
2727

@@ -32,13 +32,15 @@ Key | Type | Description
3232
`comment`|`object` | The [comment](/v3/repos/comments/#list-commit-comments-for-a-repository) itself.
3333

3434

35+
<%= webhook_payload "commit_comment" %>
36+
3537
## CreateEvent
3638

3739
Represents a created repository, branch, or tag.
3840

3941
Note: webhooks will not receive this event for created repositories.
4042

41-
### Hook name
43+
### Event name
4244

4345
`create`
4446

@@ -51,12 +53,13 @@ Key | Type | Description
5153
`master_branch`|`string` | The name of the repository's default branch (usually `master`).
5254
`description`|`string` | The repository's current description.
5355

56+
<%= webhook_payload "create" %>
5457

5558
## DeleteEvent
5659

5760
Represents a [deleted branch or tag](/v3/git/refs/#delete-a-reference).
5861

59-
### Hook name
62+
### Event name
6063

6164
`delete`
6265

@@ -67,13 +70,15 @@ Key | Type | Description
6770
`ref_type`|`string` | The object that was deleted. Can be "branch" or "tag".
6871
`ref`|`string` | The full git ref.
6972

73+
<%= webhook_payload "delete" %>
74+
7075
## DeploymentEvent
7176

7277
Represents a [deployment](/v3/repos/deployments/#list-deployments).
7378

7479
Events of this type are not visible in timelines, they are only used to trigger hooks.
7580

76-
### Hook name
81+
### Event name
7782

7883
`deployment`
7984

@@ -88,13 +93,15 @@ Key | Type | Description
8893
`description`|`string` | The optional human-readable description added to the deployment.
8994

9095

96+
<%= webhook_payload "deployment" %>
97+
9198
## DeploymentStatusEvent
9299

93100
Represents a [deployment status](/v3/repos/deployments/#list-deployment-statuses).
94101

95102
Events of this type are not visible in timelines, they are only used to trigger hooks.
96103

97-
### Hook name
104+
### Event name
98105

99106
`deployment_status`
100107

@@ -107,13 +114,15 @@ Key | Type | Description
107114
`deployment` |`hash` | The deployment that this status is associated with.
108115
`description`|`string` | The optional human-readable description added to the status.
109116

117+
<%= webhook_payload "deployment_status" %>
118+
110119
## DownloadEvent
111120

112121
Triggered when a new [download](/v3/repos/downloads/) is created.
113122

114123
Events of this type are **no longer created**, but it's possible that they exist in timelines of some users.
115124

116-
### Hook name
125+
### Event name
117126

118127
`download`
119128

@@ -130,7 +139,7 @@ Triggered when a user [follows another user](/v3/users/followers/#follow-a-user)
130139

131140
Events of this type are **no longer created**, but it's possible that they exist in timelines of some users.
132141

133-
### Hook name
142+
### Event name
134143

135144
`follow`
136145

@@ -145,7 +154,7 @@ Key | Type | Description
145154

146155
Triggered when a user [forks a repository](/v3/repos/forks/#create-a-fork).
147156

148-
### Hook name
157+
### Event name
149158

150159
`fork`
151160

@@ -155,14 +164,15 @@ Key | Type | Description
155164
----|------|-------------
156165
`forkee`|`object` | The created [repository](/v3/repos/).
157166

167+
<%= webhook_payload "fork" %>
158168

159169
## ForkApplyEvent
160170

161171
Triggered when a patch is applied in the Fork Queue.
162172

163173
Events of this type are **no longer created**, but it's possible that they exist in timelines of some users.
164174

165-
### Hook name
175+
### Event name
166176

167177
`fork_apply`
168178

@@ -181,7 +191,7 @@ Triggered when a [Gist](/v3/gists/) is created or updated.
181191

182192
Events of this type are **no longer created**, but it's possible that they exist in timelines of some users.
183193

184-
### Hook name
194+
### Event name
185195

186196
`gist`
187197

@@ -197,7 +207,7 @@ Key | Type | Description
197207

198208
Triggered when a Wiki page is created or updated.
199209

200-
### Hook name
210+
### Event name
201211

202212
`gollum`
203213

@@ -212,12 +222,13 @@ Key | Type | Description
212222
`pages[][sha]`|`string` | The latest commit SHA of the page.
213223
`pages[][html_url]`|`string` | Points to the HTML wiki page.
214224

225+
<%= webhook_payload "gollum" %>
215226

216227
## IssueCommentEvent
217228

218229
Triggered when an [issue comment](/v3/issues/comments/) is created.
219230

220-
### Hook name
231+
### Event name
221232

222233
`issue_comment`
223234

@@ -229,12 +240,13 @@ Key | Type | Description
229240
`issue`|`object` | The [issue](/v3/issues/) the comment belongs to.
230241
`comment`|`object` | The [comment](/v3/issues/comments/) itself.
231242

243+
<%= webhook_payload "issue_comment" %>
232244

233245
## IssuesEvent
234246

235247
Triggered when an [issue](/v3/issues) is created, closed or reopened.
236248

237-
### Hook name
249+
### Event name
238250

239251
`issues`
240252

@@ -245,12 +257,13 @@ Key | Type | Description
245257
`action`|`string` | The action that was performed. Can be one of "opened", "closed", or "reopened".
246258
`issue`|`object` | The [issue](/v3/issues) itself.
247259

260+
<%= webhook_payload "issues" %>
248261

249262
## MemberEvent
250263

251264
Triggered when a user is [added as a collaborator](/v3/repos/collaborators/#add-collaborator) to a repository.
252265

253-
### Hook name
266+
### Event name
254267

255268
`member`
256269

@@ -261,6 +274,7 @@ Key | Type | Description
261274
`member`|`object` | The [user](/v3/users/) that was added.
262275
`action`|`string` | The action that was performed. Currently, can only be "added".
263276

277+
<%= webhook_payload "member" %>
264278

265279
## PageBuildEvent
266280

@@ -280,24 +294,25 @@ Key | Type | Description
280294
----|------|------------
281295
`build` | `object` | The [page build](https://developer.github.com/v3/repos/pages/#list-pages-builds) itself.
282296

297+
<%= webhook_payload "page_build" %>
283298

284299
## PublicEvent
285300

286301
Triggered when a private repository is [open sourced](/v3/repos/#edit). Without a doubt: the best GitHub event.
287302

288-
### Hook name
303+
### Event name
289304

290305
`public`
291306

292307
### Payload
293308

294-
(empty payload)
309+
<%= webhook_payload "public" %>
295310

296311
## PullRequestEvent
297312

298313
Triggered when a [pull request](/v3/pulls) is created, closed, reopened or synchronized.
299314

300-
### Hook name
315+
### Event name
301316

302317
`pull_request`
303318

@@ -309,12 +324,13 @@ Key | Type | Description
309324
`number`|`integer` | The pull request number.
310325
`pull_request`|`object` | The [pull request](/v3/pulls) itself.
311326

327+
<%= webhook_payload "pull_request" %>
312328

313329
## PullRequestReviewCommentEvent
314330

315331
Triggered when a [comment is created on a portion of the unified diff](/v3/pulls/comments) of a pull request.
316332

317-
### Hook name
333+
### Event name
318334

319335
`pull_request_review_comment`
320336

@@ -326,12 +342,13 @@ Key | Type | Description
326342
`pull_request`|`object` | The [pull request](/v3/pulls/) the comment belongs to.
327343
`comment`|`object` | The [comment](/v3/pulls/comments) itself.
328344

345+
<%= webhook_payload "pull_request_review_comment" %>
329346

330347
## PushEvent
331348

332349
Triggered when a repository branch is pushed to.
333350

334-
### Hook name
351+
### Event name
335352

336353
`push`
337354

@@ -351,11 +368,13 @@ Key | Type | Description
351368
`commits[][url]`|`url` | Points to the commit API resource.
352369
`commits[][distinct]`|`boolean` | Whether this commit is distinct from any that have been pushed before.
353370

371+
<%= webhook_payload "push" %>
372+
354373
## ReleaseEvent
355374

356375
Triggered when a [release](/v3/repos/releases/#get-a-single-release) is published.
357376

358-
### Hook name
377+
### Event name
359378

360379
`release`
361380

@@ -366,14 +385,15 @@ Key | Type | Description
366385
`action`|`string` | The action that was performed. Currently, can only be "published".
367386
`release`|`object` | The [release](/v3/repos/releases/#get-a-single-release) itself.
368387

388+
<%= webhook_payload "release" %>
369389

370390
## StatusEvent
371391

372392
Triggered when the status of a Git commit changes.
373393

374394
Events of this type are not visible in timelines, they are only used to trigger hooks.
375395

376-
### Hook name
396+
### Event name
377397

378398
`status`
379399

@@ -387,14 +407,15 @@ Key | Type | Description
387407
`target_url`|`string` | The optional link added to the status.
388408
`branches`|`array` | An array of branch objects containing the status' SHA. Each branch contains the given SHA, but the SHA may or may not be the head of the branch. The array includes a maximum of 10 branches.
389409

410+
<%= webhook_payload "status" %>
390411

391412
## TeamAddEvent
392413

393414
Triggered when a [user is added to a team](/v3/orgs/teams/#add-team-member) or when a [repository is added to a team](/v3/orgs/teams/#add-team-repo).
394415

395416
Note: this event is created in [users' organization timelines](/v3/activity/events/#list-events-for-an-organization).
396417

397-
### Hook name
418+
### Event name
398419

399420
`team_add`
400421

@@ -406,6 +427,7 @@ Key | Type | Description
406427
`user`|`object` | The [user](/v3/users/) that was added to this team.
407428
`repository`|`object` | The [repository](/v3/repos/) that was added to this team.
408429

430+
<%= webhook_payload "team_add" %>
409431

410432
## WatchEvent
411433

@@ -415,7 +437,7 @@ See [this API blog post](/changes/2012-9-5-watcher-api/) for an explanation.
415437
The event’s actor is the [user](/v3/users/) who starred a repository, and the
416438
event’s repository is the [repository](/v3/repos/) that was starred.
417439

418-
### Hook name
440+
### Event name
419441

420442
`watch`
421443

@@ -424,3 +446,5 @@ event’s repository is the [repository](/v3/repos/) that was starred.
424446
Key | Type | Description
425447
----|------|-------------
426448
`action`|`string` | The action that was performed. Currently, can only be `started`.
449+
450+
<%= webhook_payload "watch" %>

layouts/sidebar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ <h3><a href="#" class="js-expand-btn collapsed arrow-btn" data-proofer-ignore></
1616
<h3><a href="#" class="js-expand-btn collapsed arrow-btn" data-proofer-ignore></a><a href="/v3/activity/">Activity</a></h3>
1717
<ul class="js-guides">
1818
<li><a href="/v3/activity/events/">Events</a></li>
19-
<li><a href="/v3/activity/events/types/">Event Types</a></li>
19+
<li><a href="/v3/activity/events/types/">Event Types &amp; Payloads</a></li>
2020
<li><a href="/v3/activity/feeds/">Feeds</a></li>
2121
<li><a href="/v3/activity/notifications/">Notifications</a></li>
2222
<li><a href="/v3/activity/starring/">Starring</a></li>

lib/resources.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,14 @@ def text_html(response, status, head = {})
109109
hs + %(<pre><code>) + res + "</code></pre>"
110110
end
111111

112+
def webhook_headers(event_name)
113+
"<pre><code>" + File.read("lib/webhooks/#{event_name}.headers.txt") + "</code></pre>"
114+
end
115+
116+
def webhook_payload(event_name)
117+
"<pre><code class='language-javascript'>" + File.read("lib/webhooks/#{event_name}.payload.json") + "</code></pre>"
118+
end
119+
112120
end
113121

114122
USER = {

lib/webhooks/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)