Sha256: 09306f8901d91c14f54a9de0cc233d3e19f5c2c40a3cce8aef0dab0666868cd4
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
module Danger module AssignStrategies class Strategy attr_accessor :mr_iid attr_accessor :project_id attr_accessor :group_name attr_accessor :client def initialize(client:, project:, mr:, group:) @client = client @project_id = project @mr_iid = mr @group_name = group end def assign!(amount) currently_assigned = fetch_assigned_reviewers() return [] if (amount - currently_assigned.length) == 0 to_be_assigned = assignees(amount - currently_assigned.length) all_assignees = currently_assigned + to_be_assigned response = client.assign_mr_to_users(project_id, mr_iid, all_assignees) all_assignees.map(&:username) end def assignees(amount) raise "To be implemented in the subclasses" end def fetch_author client.fetch_author_for_mr(@project_id, @mr_iid) end def fetch_assigned_reviewers client.fetch_mr_reviewers(@project_id, @mr_iid) end def fetch_users_in_group client.fetch_users_for_group(@group_name) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
danger-gitlab_reviewbot-1.0.2 | lib/gitlab_reviewbot/strategies/strategy.rb |
danger-gitlab_reviewbot-1.0.1 | lib/gitlab_reviewbot/strategies/strategy.rb |