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



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

def self.authors
  ['Automattic']
end

.available_optionsObject



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

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



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

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

.detailsObject



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

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

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


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

def self.is_supported?(platform)
  true
end

.return_valueObject



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

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
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb', line 7

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