diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-06 15:06:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-06 15:06:46 +0300 |
commit | 30acb0522a609c438d60f5345243e96f9a041ae6 (patch) | |
tree | ce1b11d55c510996e3ebe9a5e96db5fd08dbeaf2 /app/services/auto_merge | |
parent | d2485dbfedc4759eba5243e0d155e34494c4429b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/auto_merge')
-rw-r--r-- | app/services/auto_merge/merge_when_pipeline_succeeds_service.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/services/auto_merge/merge_when_pipeline_succeeds_service.rb b/app/services/auto_merge/merge_when_pipeline_succeeds_service.rb index 2bbb8f925a4..cb8e531f0e1 100644 --- a/app/services/auto_merge/merge_when_pipeline_succeeds_service.rb +++ b/app/services/auto_merge/merge_when_pipeline_succeeds_service.rb @@ -4,9 +4,7 @@ module AutoMerge class MergeWhenPipelineSucceedsService < AutoMerge::BaseService def execute(merge_request) super do - if merge_request.saved_change_to_auto_merge_enabled? - SystemNoteService.merge_when_pipeline_succeeds(merge_request, project, current_user, merge_request.actual_head_pipeline.sha) - end + add_system_note(merge_request) end end @@ -36,12 +34,20 @@ module AutoMerge def available_for?(merge_request) super do - merge_request.actual_head_pipeline&.active? + check_availability(merge_request) end end private + def add_system_note(merge_request) + SystemNoteService.merge_when_pipeline_succeeds(merge_request, project, current_user, merge_request.actual_head_pipeline.sha) if merge_request.saved_change_to_auto_merge_enabled? + end + + def check_availability(merge_request) + merge_request.actual_head_pipeline&.active? + end + def notify(merge_request) notification_service.async.merge_when_pipeline_succeeds(merge_request, current_user) if merge_request.saved_change_to_auto_merge_enabled? end |