diff options
author | Arthur Gautier <baloo@gandi.net> | 2015-02-26 11:17:25 +0300 |
---|---|---|
committer | Arthur Gautier <baloo@gandi.net> | 2015-05-13 10:33:20 +0300 |
commit | a927bf56b16c10bafc5bd9a14d034d2898b45c8e (patch) | |
tree | 12decb137680ab1158b110d5f281c2e62939bacf /app | |
parent | 8b9e3af8bf7a6089a11ef3f5eb91dfef4940a3f4 (diff) |
Call merge request web hook for each commits
Call merge request web hook every times a new commit hits the
source branch
Signed-off-by: Arthur Gautier <baloo@gandi.net>
Diffstat (limited to 'app')
-rw-r--r-- | app/services/merge_requests/refresh_service.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/services/merge_requests/refresh_service.rb b/app/services/merge_requests/refresh_service.rb index 66610a08a44..d0648da049b 100644 --- a/app/services/merge_requests/refresh_service.rb +++ b/app/services/merge_requests/refresh_service.rb @@ -10,6 +10,7 @@ module MergeRequests close_merge_requests reload_merge_requests + execute_mr_web_hooks comment_mr_with_commits true @@ -88,6 +89,20 @@ module MergeRequests end end + # Call merge request webhook with update branches + def execute_mr_web_hooks + merge_requests = @project.origin_merge_requests.opened + .where(source_branch: @branch_name) + .to_a + merge_requests += @fork_merge_requests.where(source_branch: @branch_name) + .to_a + merge_requests = filter_merge_requests(merge_requests) + + merge_requests.each do |merge_request| + execute_hooks(merge_request, 'update') + end + end + def filter_merge_requests(merge_requests) merge_requests.uniq.select(&:source_project) end |