lib/gitlab/danger/roulette.rb
# Assigns GitLab team members to be reviewer and maintainer
# for each change category that a Merge Request contains.
#
# @return [Array<Spin>]
Assigns GitLab team members to be reviewer and maintainer
for each change category that a Merge Request contains.
Assigns GitLab team members to be reviewer and maintainer for each change category that a Merge Request contains .
def spin(project, categories, branch_name, timezone_experiment: false)
        team =
          begin
            project_team(project)
          rescue => err
            warn("Reviewer roulette failed to load team data: #{err.message}")
            []
          end
        canonical_branch_name = canonical_branch_name(branch_name)
        spin_per_category = categories.each_with_object({}) do |category, memo|
          including_timezone = INCLUDE_TIMEZONE_FOR_CATEGORY.fetch(category, timezone_experiment)
          memo[category] = spin_for_category(team, project, category, canonical_branch_name, timezone_experiment: including_timezone)
        end
        spin_per_category.map do |category, spin|
          case category
          when :test
            if spin.reviewer.nil?
              spin.reviewer = spin_per_category[:backend]&.reviewer || spin_for_category(team, project, :backend, canonical_branch_name).reviewer
            end
          when :engineering_productivity
            if spin.maintainer.nil?
              spin.maintainer = spin_per_category[:backend]&.maintainer || spin_for_category(team, project, :backend, canonical_branch_name).maintainer
            end
          end
          spin
        end
      end
def spin ( project , categories , branch_name , timezone_experiment : false ) team = begin project_team ( project ) rescue => err warn ( "Reviewer roulette failed to load team data: #{err.message}" ) [ ] end canonical_branch_name = canonical_branch_name ( branch_name ) spin_per_category = categories . each_with_object ( { } ) do | category , memo | including_timezone = INCLUDE_TIMEZONE_FOR_CATEGORY . fetch ( category , timezone_experiment ) memo [ category ] = spin_for_category ( team , project , category , canonical_branch_name , timezone_experiment : including_timezone ) end spin_per_category . map do | category , spin | case category when :test if spin . reviewer . nil? spin . reviewer = spin_per_category [ :backend ] &. reviewer || spin_for_category ( team , project , :backend , canonical_branch_name ) . reviewer end when :engineering_productivity if spin . maintainer . nil? spin . maintainer = spin_per_category [ :backend ] &. maintainer || spin_for_category ( team , project , :backend , canonical_branch_name ) . maintainer end end spin end end
Assigns GitLab team members to be reviewer and maintainer
for each change category that a Merge Request contains.
Assigns GitLab team members to be reviewer and maintainer for each change category that a Merge Request contains .
# Fetch an already picked backend reviewer, or pick one otherwise # Fetch an already picked backend maintainer, or pick one otherwise
None
Array<Spin>
project
<not_specific>
categories
<not_specific>
branch_name
<not_specific>
timezone_experiment
<not_specific>