Class: Fastlane::Actions::MoveJiraTicketsAction

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

Overview

Move JIRA tickets and generate release notes

Class Method Summary collapse

Class Method Details

.authorsObject



35
36
37
# File 'lib/fastlane/plugin/apadmi_grout/actions/move_jira_tickets_action.rb', line 35

def self.authors
  ["[email protected]"]
end

.available_optionsObject



39
40
41
42
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/fastlane/plugin/apadmi_grout/actions/move_jira_tickets_action.rb', line 39

def self.available_options
  [
    ########## JIRA Auth ##########
    FastlaneCore::ConfigItem.new(key: :jira_username,
                                 description: "JIRA username for authentication with JIRA",
                                 env_name: "JIRA_USERNAME",
                                 type: String,
                                 verify_block: proc do |value|
                                   UI.user_error!("Didn't pass a valid JIRA username") unless value
                                 end,
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :jira_api_token,
                                 description: "JIRA api token for authentication with JIRA",
                                 env_name: "JIRA_API_TOKEN",
                                 type: String,
                                 verify_block: proc do |value|
                                   UI.user_error!("Didn't pass a valid JIRA api token") unless value
                                 end,
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :jira_project_key,
                                 description: "JIRA project key",
                                 env_name: "JIRA_PROJECT_KEY",
                                 type: String,
                                 verify_block: proc do |value|
                                   UI.user_error!("Didn't pass a valid JIRA project key, e.g PPT") unless value
                                 end,
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :jira_base_url,
                                 description: "JIRA base url for the organisation",
                                 env_name: "JIRA_BASE_URL",
                                 type: String,
                                 verify_block: proc do |value|
                                   UI.user_error!("Didn't pass a valid JIRA base url") unless value
                                 end,
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :jira_context_path,
                                 description: "JIRA context path whatever that is ¯\\_(ツ)_/¯",
                                 env_name: "JIRA_CONTEXT_PATH",
                                 default_value: "",
                                 type: String,
                                 optional: true),

    ########## Action Specific ##########
    FastlaneCore::ConfigItem.new(key: :jira_status_to,
                                 description: "The JIRA status to move the tickets to",
                                 env_name: "JIRA_STATUS_TO",
                                 type: String,
                                 verify_block: proc do |value|
                                   UI.user_error!("Didn't pass a valid JIRA status") unless value
                                 end,
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :versions,
                                 description: "The versions to add to the jira ticket",
                                 type: Array,
                                 verify_block: proc do |value|
                                   UI.user_error!("Didn't pass a valid array of versions") unless value || value.empty
                                 end,
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :issues,
                                 description: "The issues to be moved",
                                 type: Array,
                                 verify_block: proc do |value|
                                   UI.user_error!("Didn't pass a valid array of issues") unless value
                                 end,
                                 optional: false)
  ]
end

.descriptionObject



31
32
33
# File 'lib/fastlane/plugin/apadmi_grout/actions/move_jira_tickets_action.rb', line 31

def self.description
  "Convenience lane that moves all supplied jira tickets to new status and assigns versions."
end

.is_supported?(_platform) ⇒ Boolean

Returns:

  • (Boolean)


107
108
109
# File 'lib/fastlane/plugin/apadmi_grout/actions/move_jira_tickets_action.rb', line 107

def self.is_supported?(_platform)
  true
end

.run(params) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fastlane/plugin/apadmi_grout/actions/move_jira_tickets_action.rb', line 11

def self.run(params)
  logger = FastLane::FastlaneLogger.new
  logger.message("Moving Jira tickets")

  build_tools = Apadmi::Grout::DependencyInjector.new(
    params[:jira_username],
    params[:jira_api_token],
    params[:jira_base_url],
    params[:jira_context_path],
    params[:jira_project_key],
    logger
  )

  build_tools.move_jira_tickets_action.run(
    params[:versions],
    params[:issues],
    params[:jira_status_to]
  )
end