Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
ac6f0321
Commit
ac6f0321
authored
Oct 03, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7779 from Bugagazavr/hook_tag_push_events
Add tag push events to project hook api
parents
03b44916
b4963e9d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
3 deletions
+19
-3
app/models/hooks/web_hook.rb
app/models/hooks/web_hook.rb
+1
-0
doc/api/projects.md
doc/api/projects.md
+2
-0
lib/api/entities.rb
lib/api/entities.rb
+2
-1
lib/api/project_hooks.rb
lib/api/project_hooks.rb
+14
-2
No files found.
app/models/hooks/web_hook.rb
View file @
ac6f0321
...
@@ -21,6 +21,7 @@ class WebHook < ActiveRecord::Base
...
@@ -21,6 +21,7 @@ class WebHook < ActiveRecord::Base
default_value_for
:push_events
,
true
default_value_for
:push_events
,
true
default_value_for
:issues_events
,
false
default_value_for
:issues_events
,
false
default_value_for
:merge_requests_events
,
false
default_value_for
:merge_requests_events
,
false
default_value_for
:tag_push_events
,
false
# HTTParty timeout
# HTTParty timeout
default_timeout
Gitlab
.
config
.
gitlab
.
webhook_timeout
default_timeout
Gitlab
.
config
.
gitlab
.
webhook_timeout
...
...
doc/api/projects.md
View file @
ac6f0321
...
@@ -447,6 +447,7 @@ Parameters:
...
@@ -447,6 +447,7 @@ Parameters:
-
`push_events`
- Trigger hook on push events
-
`push_events`
- Trigger hook on push events
-
`issues_events`
- Trigger hook on issues events
-
`issues_events`
- Trigger hook on issues events
-
`merge_requests_events`
- Trigger hook on merge_requests events
-
`merge_requests_events`
- Trigger hook on merge_requests events
-
`tag_push_events`
- Trigger hook on push_tag events
### Edit project hook
### Edit project hook
...
@@ -464,6 +465,7 @@ Parameters:
...
@@ -464,6 +465,7 @@ Parameters:
-
`push_events`
- Trigger hook on push events
-
`push_events`
- Trigger hook on push events
-
`issues_events`
- Trigger hook on issues events
-
`issues_events`
- Trigger hook on issues events
-
`merge_requests_events`
- Trigger hook on merge_requests events
-
`merge_requests_events`
- Trigger hook on merge_requests events
-
`tag_push_events`
- Trigger hook on push_tag events
### Delete project hook
### Delete project hook
...
...
lib/api/entities.rb
View file @
ac6f0321
...
@@ -30,7 +30,8 @@ module API
...
@@ -30,7 +30,8 @@ module API
end
end
class
ProjectHook
<
Hook
class
ProjectHook
<
Hook
expose
:project_id
,
:push_events
,
:issues_events
,
:merge_requests_events
expose
:project_id
,
:push_events
expose
:issues_events
,
:merge_requests_events
,
:tag_push_events
end
end
class
ForkedFromProject
<
Grape
::
Entity
class
ForkedFromProject
<
Grape
::
Entity
...
...
lib/api/project_hooks.rb
View file @
ac6f0321
...
@@ -38,7 +38,13 @@ module API
...
@@ -38,7 +38,13 @@ module API
# POST /projects/:id/hooks
# POST /projects/:id/hooks
post
":id/hooks"
do
post
":id/hooks"
do
required_attributes!
[
:url
]
required_attributes!
[
:url
]
attrs
=
attributes_for_keys
[
:url
,
:push_events
,
:issues_events
,
:merge_requests_events
]
attrs
=
attributes_for_keys
[
:url
,
:push_events
,
:issues_events
,
:merge_requests_events
,
:tag_push_events
]
@hook
=
user_project
.
hooks
.
new
(
attrs
)
@hook
=
user_project
.
hooks
.
new
(
attrs
)
if
@hook
.
save
if
@hook
.
save
...
@@ -62,7 +68,13 @@ module API
...
@@ -62,7 +68,13 @@ module API
put
":id/hooks/:hook_id"
do
put
":id/hooks/:hook_id"
do
@hook
=
user_project
.
hooks
.
find
(
params
[
:hook_id
])
@hook
=
user_project
.
hooks
.
find
(
params
[
:hook_id
])
required_attributes!
[
:url
]
required_attributes!
[
:url
]
attrs
=
attributes_for_keys
[
:url
,
:push_events
,
:issues_events
,
:merge_requests_events
]
attrs
=
attributes_for_keys
[
:url
,
:push_events
,
:issues_events
,
:merge_requests_events
,
:tag_push_events
]
if
@hook
.
update_attributes
attrs
if
@hook
.
update_attributes
attrs
present
@hook
,
with:
Entities
::
ProjectHook
present
@hook
,
with:
Entities
::
ProjectHook
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment