summaryrefslogtreecommitdiff
path: root/lib/api/project_hooks.rb
diff options
context:
space:
mode:
authorDuana Saskia <starkcoffee@users.noreply.github.com>2018-06-07 09:35:17 +0200
committerDuana Saskia <starkcoffee@users.noreply.github.com>2018-08-13 13:20:58 +0200
commitece6a1ea6ecffdbde5ff7d663f1ad1eb74f78aa6 (patch)
tree288e34ff932b6c84e1a1c5ead26cbd8f80ea12f5 /lib/api/project_hooks.rb
parent07356866b2ce85f4d724c96f14e129fbe6a56963 (diff)
downloadgitlab-ce-ece6a1ea6ecffdbde5ff7d663f1ad1eb74f78aa6.tar.gz
Filter project hooks by branch
Allow specificying a branch filter for a project hook and only trigger a project hook if either the branch filter is blank or the branch matches. Only supported for push_events for now.
Diffstat (limited to 'lib/api/project_hooks.rb')
-rw-r--r--lib/api/project_hooks.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/api/project_hooks.rb b/lib/api/project_hooks.rb
index 4760a1c08d7..0fb454bc22e 100644
--- a/lib/api/project_hooks.rb
+++ b/lib/api/project_hooks.rb
@@ -20,6 +20,7 @@ module API
optional :wiki_page_events, type: Boolean, desc: "Trigger hook on wiki events"
optional :enable_ssl_verification, type: Boolean, desc: "Do SSL verification when triggering the hook"
optional :token, type: String, desc: "Secret token to validate received payloads; this will not be returned in the response"
+ optional :push_events_branch_filter, type: String, desc: "Trigger hook on specified branch only"
end
end
@@ -63,6 +64,7 @@ module API
present hook, with: Entities::ProjectHook
else
error!("Invalid url given", 422) if hook.errors[:url].present?
+ error!("Invalid branch filter given", 422) if hook.errors[:push_events_branch_filter].present?
not_found!("Project hook #{hook.errors.messages}")
end
@@ -84,6 +86,7 @@ module API
present hook, with: Entities::ProjectHook
else
error!("Invalid url given", 422) if hook.errors[:url].present?
+ error!("Invalid branch filter given", 422) if hook.errors[:push_events_branch_filter].present?
not_found!("Project hook #{hook.errors.messages}")
end