Class: Fastlane::Actions::GitlabMergeRequestParticipantsAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/gitlab_merge_request_participants/actions/gitlab_merge_request_participants_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



30
31
32
# File 'lib/fastlane/plugin/gitlab_merge_request_participants/actions/gitlab_merge_request_participants_action.rb', line 30

def self.authors
  ["xiongzenghui"]
end

.available_optionsObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/fastlane/plugin/gitlab_merge_request_participants/actions/gitlab_merge_request_participants_action.rb', line 43

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :host,
      description: "host for gitlab server",
      verify_block: proc do |value|
        UI.user_error!("No host given") unless (value and not value.empty?)
      end
    ),
    FastlaneCore::ConfigItem.new(
      key: :private_token,
      description: "private_token for gitlab server",
      verify_block: proc do |value|
        UI.user_error!("No private_token given") unless (value and not value.empty?)
      end
    ),
    FastlaneCore::ConfigItem.new(
      key: :project_id,
      description: "project_id for gitlab git repo",
      verify_block: proc do |value|
        UI.user_error!("No project_id given") unless (value and not value.empty?)
      end
    ),
    FastlaneCore::ConfigItem.new(
      key: :mr_id,
      description: "id for gitlab merge request",
      verify_block: proc do |value|
        UI.user_error!("No mr_id for given") unless (value and not value.empty?)
      end
    ),
    FastlaneCore::ConfigItem.new(
      key: :ignore_users,
      description: "ignore user id",
      is_string: false,
      optional: true
    )
  ]
end

.descriptionObject



26
27
28
# File 'lib/fastlane/plugin/gitlab_merge_request_participants/actions/gitlab_merge_request_participants_action.rb', line 26

def self.description
  "Get a list of merge request participants"
end

.detailsObject



38
39
40
41
# File 'lib/fastlane/plugin/gitlab_merge_request_participants/actions/gitlab_merge_request_participants_action.rb', line 38

def self.details
  # Optional:
  "Get a list of merge request participants"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/fastlane/plugin/gitlab_merge_request_participants/actions/gitlab_merge_request_participants_action.rb', line 82

def self.is_supported?(platform)
  true
end

.return_valueObject



34
35
36
# File 'lib/fastlane/plugin/gitlab_merge_request_participants/actions/gitlab_merge_request_participants_action.rb', line 34

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fastlane/plugin/gitlab_merge_request_participants/actions/gitlab_merge_request_participants_action.rb', line 7

def self.run(params)
  require 'gitlab'
  
  host = params[:host]
  private_token = params[:private_token]
  project_id = params[:project_id]
  mr_id = params[:mr_id]
  ignore_users = params[:ignore_users]

  gc = Gitlab.client(endpoint: host, private_token: private_token)
  gc.merge_request_participants(project_id, mr_id).map {|user|
    if ignore_users && ignore_users.include?(user.id)
      nil
    else
      gc.user(user.id).public_email.split('@')[0]
    end
  }.reject {|name| name.nil?}
end