Class: Fastlane::Actions::CloseMilestoneAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



25
26
27
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb', line 25

def self.authors
  ['Automattic']
end

.available_optionsObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb', line 38

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :repository,
                                 env_name: 'GHHELPER_REPOSITORY',
                                 description: 'The remote path of the GH repository on which we work',
                                 optional: false,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :milestone,
                                 env_name: 'GHHELPER_MILESTONE',
                                 description: 'The GitHub milestone',
                                 optional: false,
                                 type: String),
    Fastlane::Helper::GithubHelper.github_token_config_item,
  ]
end

.descriptionObject



21
22
23
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb', line 21

def self.description
  'Closes an existing milestone in the project'
end

.detailsObject



33
34
35
36
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb', line 33

def self.details
  # Optional:
  'Closes an existing milestone in the project'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb', line 54

def self.is_supported?(platform)
  true
end

.return_valueObject



29
30
31
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb', line 29

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

.run(params) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb', line 9

def self.run(params)
  repository = params[:repository]
  milestone_title = params[:milestone]

  github_helper = Fastlane::Helper::GithubHelper.new(github_token: params[:github_token])
  milestone = github_helper.get_milestone(repository, milestone_title)

  UI.user_error!("Milestone #{milestone_title} not found.") if milestone.nil?

  github_helper.update_milestone(repository: repository, number: milestone[:number], state: 'closed')
end