Class: Fastlane::Actions::ReleaseNotesAction

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

Helpers collapse

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorObject



127
128
129
# File 'lib/fastlane/plugin/cerberus/actions/release_notes_action.rb', line 127

def self.author
  'Harry Singh <[email protected]>'
end

.available_optionsObject



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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/fastlane/plugin/cerberus/actions/release_notes_action.rb', line 66

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :issues,
      env_name: 'FL_RELEASE_NOTES_ISSUES',
      description:  'Jira issues',
      optional: true,
      default_value: [],
      type: Array
    ),
    FastlaneCore::ConfigItem.new(
      key: :include_commits,
      env_name: 'FL_HOCKEY_COMMENT_INCLUDE_COMMITS',
      description:  'Additional commits',
      optional: true,
      default_value: [],
      type: Array
    ),
    FastlaneCore::ConfigItem.new(
      key: :build_url,
      env_name: 'FL_RELEASE_NOTES_BUILD_URL',
      description:  'Link to the ci build',
      optional: true,
      default_value: ENV['BUILD_URL']
    ),
    FastlaneCore::ConfigItem.new(
      key: :username,
      env_name: 'FL_JIRA_USERNAME',
      description:  'Jira user',
      optional: false
    ),
    FastlaneCore::ConfigItem.new(
      key: :password,
      env_name: 'FL_JIRA_PASSWORD',
      description:  'Jira user',
      optional: false
    ),
    FastlaneCore::ConfigItem.new(
      key: :host,
      env_name: 'FL_JIRA_HOST',
      description:  'Jira location',
      optional: false
    ),
    FastlaneCore::ConfigItem.new(
      key: :context_path,
      env_name: 'FL_JIRA_CONTEXT_PATH',
      description:  'Jira context path',
      optional: true,
      default_value: ''
    ),
    FastlaneCore::ConfigItem.new(
      key: :disable_ssl_verification,
      env_name: 'FL_JIRA_DISABLE_SSL_VERIFICATION',
      description:  'Jira SSL Verification mode',
      optional: true,
      default_value: false,
      type: Boolean
    )
  ]
end

.comment(issues:, include_commits:, url:) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/fastlane/plugin/cerberus/actions/release_notes_action.rb', line 34

def self.comment(issues:, include_commits:, url:)
  changes = format_issues(issues: issues, include_commits: include_commits)
  changes = 'No changes included.' if changes.to_s.empty?

  changelog = [
    '### Changelog',
    '',
    changes,
    '',
    "Built by [Jenkins](#{url})"
  ].join("\n")

  UI.important(changelog)
  return changelog
end

.detailsObject



54
55
56
# File 'lib/fastlane/plugin/cerberus/actions/release_notes_action.rb', line 54

def self.details
  'Creates a markdown friendly change log from the Jira issues and the Jenkins build url'
end

.format(issue:) ⇒ Object



23
24
25
# File 'lib/fastlane/plugin/cerberus/actions/release_notes_action.rb', line 23

def self.format(issue:)
  "[#{issue.key}](#{@jira_helper.url(issue: issue)}) - #{issue.summary}"
end

.format_issues(issues:, include_commits:) ⇒ Object



27
28
29
30
31
32
# File 'lib/fastlane/plugin/cerberus/actions/release_notes_action.rb', line 27

def self.format_issues(issues:, include_commits:)
  issues.map { |issue| format(issue: issue) }
        .concat(include_commits)
        .map { |change| change.prepend("- ") }
        .join("\n")
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/fastlane/plugin/cerberus/actions/release_notes_action.rb', line 58

def self.is_supported?(platform)
  platform == :ios
end

.outputObject



62
63
64
# File 'lib/fastlane/plugin/cerberus/actions/release_notes_action.rb', line 62

def self.output
  String
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fastlane/plugin/cerberus/actions/release_notes_action.rb', line 7

def self.run(params)
  @jira_helper = Helper::CerberusHelper.jira_helper(
    host: params[:host],
    username: params[:username],
    password: params[:password],
    context_path: params[:context_path],
    disable_ssl_verification: params[:disable_ssl_verification]
  )
  issues = @jira_helper.get(issues: params[:issues])
  Actions.lane_context[SharedValues::FL_CHANGELOG] = comment(issues: issues, include_commits: params[:include_commits], url: params[:build_url])
end