Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 1, 2017. It is now read-only.

Commit42fb154

Browse files
committed
describe hook config changes better
1 parent22a13da commit42fb154

File tree

2 files changed

+32
-7
lines changed

2 files changed

+32
-7
lines changed

‎content/v3/repos/hooks.md‎

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,23 @@ for. Default: `["push"]`.
8484
:_Optional_**boolean** - Determines whether the hook is actually
8585
triggered on pushes.
8686

87+
Example: The["web" service hook](https://github.com/github/github-services/blob/master/services/web.rb#L4-11)
88+
takes these fields:
89+
90+
*`url`
91+
*`content_type`
92+
*`secret`
93+
94+
Here's how you can setup a hook that posts raw JSON (instead of the default
95+
legacy format):
96+
8797
<%= json\
8898
:name => "web",
8999
:active => true,
100+
:events =>['push', 'pull_request'],
90101
:config => {
91-
:url => 'http://something.com/webhook'}
102+
:url => 'http://something.com/webhook',
103+
:content_type => 'json'}
92104
%>
93105

94106
###Response
@@ -97,7 +109,7 @@ triggered on pushes.
97109
:Location => 'https://api.github.com/repos/user/repo/hooks/1' %>
98110
<%= json:hook %>
99111

100-
###Edit a hook
112+
##Edit a hook
101113

102114
PATCH /repos/:owner/:repo/hooks/:id
103115

@@ -117,6 +129,9 @@ Booleans are stored internally as "1" for true, and "0" for false. Any
117129
JSON true/false values will be converted automatically.
118130

119131

132+
133+
You can change a hook to send straight JSON by
134+
120135
`events`
121136
:_Optional_**array** - Determines what events the hook is triggered
122137
for. This replaces the entire array of events. Default:`["push"]`.
@@ -133,13 +148,23 @@ list of events that the Hook triggers for.
133148
:_Optional_**boolean** - Determines whether the hook is actually
134149
triggered on pushes.
135150

151+
Example: The["web" service hook](https://github.com/github/github-services/blob/master/services/web.rb#L4-11)
152+
takes these fields:
153+
154+
*`url`
155+
*`content_type`
156+
*`secret`
157+
158+
Here's how you can setup a hook that posts raw JSON (instead of the default
159+
legacy format):
160+
136161
<%= json\
137-
:name => "campfire",
162+
:name => "web",
138163
:active => true,
164+
:add_events =>['pull_request'],
139165
:config => {
140-
:subdomain => 'github',
141-
:room => 'Commits',
142-
:token => 'abc123'}
166+
:url => "http://requestb.in",
167+
:content_type => "json"}
143168
%>
144169

145170
###Response

‎lib/resources.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ def text_html(response, status, head = {})
888888
"updated_at"=>"2011-09-06T20:39:23Z",
889889
"created_at"=>"2011-09-06T17:26:27Z",
890890
"name"=>"web",
891-
"events"=>["push"],
891+
"events"=>["push","pull_request"],
892892
"active"=>true,
893893
"config"=>
894894
{'url'=>'http://example.com','content_type'=>'json'},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp