Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-09-05 16:39:41 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-09-05 16:39:41 +0300
commit464b0de1acfc9383a551a05efa8c8a705c8bf70c (patch)
tree6766e8c53a968ed40cd71748c0e0b7d622f8c3df /lib/api
parent97ee68b1750bade46ef6c1d7c813bc917a13d89d (diff)
parent9d742e61a79dcc85589598259e2fdac030b7ac00 (diff)
Merge branch 'filter-web-hooks-by-branch' into 'master'
Filter web hooks by branch See merge request gitlab-org/gitlab-ce!19513
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/entities.rb1
-rw-r--r--lib/api/project_hooks.rb3
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index e63f11d721e..90abee94f6a 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -105,6 +105,7 @@ module API
expose :project_id, :issues_events, :confidential_issues_events
expose :note_events, :confidential_note_events, :pipeline_events, :wiki_page_events
expose :job_events
+ expose :push_events_branch_filter
end
class SharedGroup < Grape::Entity
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