app/services/merge_requests/merge_when_build_succeeds_service.rb
def trigger(commit_status)
      merge_requests = merge_request_from(commit_status)

      merge_requests.each do |merge_request|
        next unless merge_request.merge_when_build_succeeds?
        next unless merge_request.mergeable?

        ci_commit = merge_request.ci_commit
        next unless ci_commit
        next unless ci_commit.sha == commit_status.sha
        next unless ci_commit.success?

        MergeWorker.perform_async(merge_request.id, merge_request.merge_user_id, merge_request.merge_params)
      end
    end
# Triggers the automatic merge of merge_request once the build succeeds
Triggers the automatic merge of merge_request once the build succeeds
Triggers the automatic merge of merge_request once the build succeeds
def trigger(commit_status)
      merge_requests = merge_request_from(commit_status)
      merge_requests.each do |merge_request|
        next unless merge_request.merge_when_build_succeeds?
        next unless merge_request.mergeable?
        ci_commit = merge_request.ci_commit
        next unless ci_commit
        next unless ci_commit.sha == commit_status.sha
        next unless ci_commit.success?
        MergeWorker.perform_async(merge_request.id, merge_request.merge_user_id, merge_request.merge_params)
      end
    end
def trigger ( commit_status ) merge_requests = merge_request_from ( commit_status ) merge_requests . each do | merge_request | next unless merge_request . merge_when_build_succeeds? next unless merge_request . mergeable? ci_commit = merge_request . ci_commit next unless ci_commit next unless ci_commit . sha == commit_status . sha next unless ci_commit . success? MergeWorker . perform_async ( merge_request . id , merge_request . merge_user_id , merge_request . merge_params ) end end
Triggers the automatic merge of merge_request once the build succeeds
Triggers the automatic merge of merge_request once the build succeeds
commit_status