Skip to content

Commit 185f2d3

Browse files
author
Hubot
committed
Sync changes from upstream repository
1 parent c3932d2 commit 185f2d3

3 files changed

Lines changed: 86 additions & 19 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: New webhook event actions are now live
3+
author_name: davidcelis
4+
---
5+
6+
As [promised last month][notice], we've expanded several webhook events with new functionality. Webhook events involving repositories, issues, and comments have all been updated to include new actions.
7+
8+
Repository events will now fire when a repository is deleted, made public, or made private. In addition, while repository creation events will still only fire for organizations, the new repository event actions can be delivered for user-owned repositories.
9+
10+
Events for issues and comments have also been updated and will now fire when issues or comments are edited or deleted. When an issue or a comment has been edited, the event's payload will include a "changes" object. For example, if you've updated the title and body of an issue, the webhook payload informs you of what the issue used to look like:
11+
12+
```json
13+
{
14+
"action": "edited",
15+
"changes": {
16+
"title": { "from": "This is the old title." },
17+
"body": { "from": "This is the old body." }
18+
},
19+
"issue": {
20+
"title": "This is the new title.",
21+
"body": "This is the new body."
22+
}
23+
}
24+
```
25+
26+
The new values will be present in the `issue` object itself, as detailed above. Unchanged values will not be present within the `changes` object. Comment edits follow a similar pattern, though because they have no titles, the only change included in the payload would be the comment's body.
27+
28+
## List of comprehensive changes
29+
30+
New actions were added to four events, all of which are detailed below.
31+
32+
### [RepositoryEvent][repository-event]
33+
34+
* `deleted`: sent when a user-owned or organization-owned repository is deleted.
35+
* `publicized`: sent when a user-owned or organization-owned repository is switched from private to public.
36+
* `privatized`: sent when a user-owned or organization-owned repository is switched from public to private.
37+
38+
### [IssuesEvent][issues-event]
39+
40+
* `edited`: sent when the title and/or body of an issue or pull request is edited.
41+
42+
### [IssueCommentEvent][issue-comment-event]
43+
44+
* `edited`: sent when a comment on an issue or pull request is edited
45+
* `deleted`: sent when a comment on an issue or pull request is deleted
46+
47+
### [PullRequestReviewCommentEvent][pull-request-review-comment-event]
48+
49+
* `edited`: sent when a comment on a pull request's unified diff (in the Files Changed tab) is edited
50+
* `deleted`: sent when a comment on a pull request's unified diff (in the Files Changed tab) is deleted
51+
52+
Take a look at [the documentation][docs] for full details. If you have any questions or feedback, please [get in touch][get-in-touch].
53+
54+
[docs]: https://developer.github.com/webhooks/
55+
[get-in-touch]: https://github.com/contact?form[subject]=New+Webhook+Actions
56+
[issue-comment-event]: https://developer.github.com/v3/activity/events/types/#issuecommentevent
57+
[issues-event]: https://developer.github.com/v3/activity/events/types/#issuesevent
58+
[notice]: https://developer.github.com/changes/2016-03-15-new-webhook-actions/
59+
[pull-request-review-comment-event]: https://developer.github.com/v3/activity/events/types/#pullrequestreviewcommentevent
60+
[repository-event]: https://developer.github.com/v3/activity/events/types/#repositoryevent

content/v3/activity/events/types.md

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Key | Type | Description
8383

8484
Represents a [deployment](/v3/repos/deployments/#list-deployments).
8585

86-
Events of this type are not visible in timelines, they are only used to trigger hooks.
86+
Events of this type are not visible in timelines. These events are only used to trigger hooks.
8787

8888
### Events API payload
8989

@@ -108,7 +108,7 @@ Key | Type | Description
108108

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

111-
Events of this type are not visible in timelines, they are only used to trigger hooks.
111+
Events of this type are not visible in timelines. These events are only used to trigger hooks.
112112

113113
### Events API payload
114114

@@ -239,13 +239,15 @@ Key | Type | Description
239239

240240
## IssueCommentEvent
241241

242-
Triggered when an [issue comment](/v3/issues/comments/) is created on an issue or pull request.
242+
Triggered when an [issue comment](/v3/issues/comments/) is created, edited, or deleted.
243243

244244
### Events API payload
245245

246246
Key | Type | Description
247247
----|------|-------------
248-
`action`|`string` | The action that was performed on the comment. Currently, can only be "created".
248+
`action`|`string` | The action that was performed on the comment. Can be one of "created", "edited", or "deleted".
249+
`changes`|`object` | The changes to the comment if the action was "edited".
250+
`changes[from][body]` |`string` | The previous version of the body if the action was "edited".
249251
`issue`|`object` | The [issue](/v3/issues/) the comment belongs to.
250252
`comment`|`object` | The [comment](/v3/issues/comments/) itself.
251253

@@ -259,14 +261,17 @@ Key | Type | Description
259261

260262
## IssuesEvent
261263

262-
Triggered when an [issue](/v3/issues) is assigned, unassigned, labeled, unlabeled, opened, closed, or reopened.
264+
Triggered when an [issue](/v3/issues) is assigned, unassigned, labeled, unlabeled, opened, edited, closed, or reopened.
263265

264266
### Events API payload
265267

266268
Key | Type | Description
267269
----|------|-------------
268-
`action`|`string` | The action that was performed. Can be one of "assigned", "unassigned", "labeled", "unlabeled", "opened", "closed", or "reopened".
270+
`action`|`string` | The action that was performed. Can be one of "assigned", "unassigned", "labeled", "unlabeled", "opened", "edited", "closed", or "reopened".
269271
`issue`|`object` | The [issue](/v3/issues) itself.
272+
`changes`|`object`| The changes to the issue if the action was "edited".
273+
`changes[from][title]`|`string` | The previous version of the title if the action was "edited".
274+
`changes[from][body]`|`string` | The previous version of the body if the action was "edited".
270275
`assignee`|`object` | The optional user who was assigned or unassigned from the issue.
271276
`label`|`object` | The optional label that was added or removed from the issue.
272277

@@ -301,7 +306,7 @@ Key | Type | Description
301306

302307
Triggered when a user is added or removed from a team.
303308

304-
Events of this type are not visible in timelines, they are only used to trigger organization webhooks.
309+
Events of this type are not visible in timelines. These events are only used to trigger hooks.
305310

306311
### Events API payload
307312

@@ -326,7 +331,7 @@ Represents an attempted build of a GitHub Pages site, whether successful or not.
326331

327332
Triggered on push to a GitHub Pages enabled branch (`gh-pages` for project pages, `master` for user and organization pages).
328333

329-
Events of this type are not visible in timelines, they are only used to trigger hooks.
334+
Events of this type are not visible in timelines. These events are only used to trigger hooks.
330335

331336
### Events API payload
332337

@@ -378,13 +383,15 @@ Key | Type | Description
378383

379384
## PullRequestReviewCommentEvent
380385

381-
Triggered when a [comment is created on a portion of the unified diff](/v3/pulls/comments) of a pull request.
386+
Triggered when a [comment on a Pull Request's unified diff](/v3/pulls/comments) is created, edited, or deleted (in the Files Changed tab).
382387

383388
### Events API payload
384389

385390
Key | Type | Description
386391
----|------|-------------
387-
`action`|`string` | The action that was performed on the comment. Currently, can only be "created".
392+
`action`|`string` | The action that was performed on the comment. Can be one of `created`, `edited`, or `deleted`.
393+
`changes`|`object`| The changes to the comment if the action was "edited".
394+
`changes[from][body]`|`string` | The previous version of the body if the action was "edited".
388395
`pull_request`|`object` | The [pull request](/v3/pulls/) the comment belongs to.
389396
`comment`|`object` | The [comment](/v3/pulls/comments) itself.
390397

@@ -453,16 +460,16 @@ Key | Type | Description
453460

454461
## RepositoryEvent
455462

456-
Triggered when a repository is created.
463+
Triggered when a repository is created, deleted, made public, or made private.
457464

458-
Events of this type are not visible in timelines, they are only used to trigger organization webhooks.
465+
Events of this type are not visible in timelines. These events are only used to trigger hooks.
459466

460467
### Events API payload
461468

462469
Key | Type | Description
463470
----|------|-------------
464-
`action` |`string` | The action that was performed. Currently, can only be "created".
465-
`repository`|`object` | The [repository](/v3/repos/) that was created.
471+
`action` |`string` | The action that was performed. This can be one of `created`, `deleted`, `publicized`, or `privatized`.
472+
`repository`|`object` | The [repository](/v3/repos/) itself.
466473

467474
### Webhook event name
468475

@@ -476,7 +483,7 @@ Key | Type | Description
476483

477484
Triggered when the status of a Git commit changes.
478485

479-
Events of this type are not visible in timelines, they are only used to trigger hooks.
486+
Events of this type are not visible in timelines. These events are only used to trigger hooks.
480487

481488
### Events API payload
482489

content/webhooks/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ Name | Description
4848
[`deployment_status`][event-types-deployment_status] | Any time a deployment for a Repository has a status update from the API.
4949
[`fork`][event-types-fork] | Any time a Repository is forked.
5050
[`gollum`][event-types-gollum] | Any time a Wiki page is updated.
51-
[`issue_comment`][event-types-issue_comment] | Any time an Issue or Pull Request is [commented](/v3/issues/comments/) on.
52-
[`issues`][event-types-issues] | Any time an Issue is assigned, unassigned, labeled, unlabeled, opened, closed, or reopened.
51+
[`issue_comment`][event-types-issue_comment] | Any time a [comment on an issue]([commented](/v3/issues/comments/) is created or edited
52+
[`issues`][event-types-issues] | Any time an Issue is assigned, unassigned, labeled, unlabeled, opened, edited, closed, or reopened.
5353
[`member`][event-types-member] | Any time a User is added as a collaborator to a non-Organization Repository.
5454
[`membership`][event-types-membership] | Any time a User is added or removed from a team. **Organization hooks only**.
5555
[`page_build`][event-types-page_build] | Any time a Pages site is built or results in a failed build.
5656
[`public`][event-types-public] | Any time a Repository changes from private to public.
57-
[`pull_request_review_comment`][event-types-pull_request_review_comment] | Any time a [comment is created on a portion of the unified diff](/v3/pulls/comments) of a pull request (the Files Changed tab).
57+
[`pull_request_review_comment`][event-types-pull_request_review_comment] | Any time a [comment on a pull request's unified diff](/v3/pulls/comments) is created, edited, or deleted (in the Files Changed tab).
5858
[`pull_request`][event-types-pull_request] | Any time a Pull Request is assigned, unassigned, labeled, unlabeled, opened, closed, reopened, or synchronized (updated due to a new push in the branch that the pull request is tracking).
5959
[`push`][event-types-push] | Any Git push to a Repository, including editing tags or branches. Commits via API actions that update references are also counted. **This is the default event.**
60-
[`repository`][event-types-repository] | Any time a Repository is created. **Organization hooks only**.
60+
[`repository`][event-types-repository] | Any time a Repository is created, deleted, made public, or made private.
6161
[`release`][event-types-release] | Any time a Release is published in a Repository.
6262
[`status`][event-types-status] | Any time a Repository has a status update from the API
6363
[`team_add`][event-types-team_add] | Any time a team is added or modified on a Repository.

0 commit comments

Comments
 (0)