Class: Fastlane::Actions::FindCommitsAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::FindCommitsAction
- Defined in:
- lib/fastlane/plugin/cerberus/actions/find_commits_action.rb
Helpers collapse
Documentation collapse
- .author ⇒ Object
- .available_options ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
Class Method Summary collapse
Class Method Details
.author ⇒ Object
95 96 97 |
# File 'lib/fastlane/plugin/cerberus/actions/find_commits_action.rb', line 95 def self. 'Syd Srirak <[email protected]>' end |
.available_options ⇒ Object
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 |
# File 'lib/fastlane/plugin/cerberus/actions/find_commits_action.rb', line 62 def self. [ FastlaneCore::ConfigItem.new( key: :from, env_name: 'FL_FIND_COMMITS_FROM', description: 'start commit', optional: true, default_value: ENV['FL_FIND_TICKETS_FROM'] || 'HEAD' ), FastlaneCore::ConfigItem.new( key: :to, env_name: 'FL_FIND_COMMITS_TO', description: 'end commit', optional: true, default_value: ENV['FL_FIND_TICKETS_TO'] || ENV['GIT_PREVIOUS_SUCCESSFUL_COMMIT'] || 'HEAD' ), FastlaneCore::ConfigItem.new( key: :matching, env_name: 'FL_FIND_COMMITS_MATCHING', description: 'regex to only include to the change log', optional: true, default_value: ENV['FL_FIND_TICKETS_MATCHING'] || '([A-Z]+-\d+)' ), FastlaneCore::ConfigItem.new( key: :pretty, env_name: 'FL_FIND_COMMITS_PRETTY_FORMAT', description: 'git pretty format', optional: true, default_value: ENV['FL_FIND_TICKETS_PRETTY_FORMAT'] || '%s' ) ] end |
.details ⇒ Object
50 51 52 |
# File 'lib/fastlane/plugin/cerberus/actions/find_commits_action.rb', line 50 def self.details 'Extracts additional issues from the log' end |
.is_supported?(platform) ⇒ Boolean
54 55 56 |
# File 'lib/fastlane/plugin/cerberus/actions/find_commits_action.rb', line 54 def self.is_supported?(platform) platform == :ios end |
.log(from:, to:, pretty:) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/fastlane/plugin/cerberus/actions/find_commits_action.rb', line 22 def self.log(from:, to:, pretty:) if to.to_s.empty? || from.to_s.empty? UI.important('Git Tickets: log(to:, from:) cannot be nil') return nil end other_action.changelog_from_git_commits( between: [from, to], pretty: pretty, merge_commit_filtering: :exclude_merges.to_s ) end |
.output ⇒ Object
58 59 60 |
# File 'lib/fastlane/plugin/cerberus/actions/find_commits_action.rb', line 58 def self.output [String] end |
.run(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/fastlane/plugin/cerberus/actions/find_commits_action.rb', line 4 def self.run(params) regex = Regexp.new(params[:matching]) changelog = log(from: params[:from], to: params[:to], pretty: params[:pretty]) if changelog.to_s.empty? UI.important('No issues found.') return [] end tickets = tickets(log: changelog, regex: regex) UI.important("Additional Issues: #{tickets.join("\n")}") return tickets end |
.tickets(log:, regex:) ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/fastlane/plugin/cerberus/actions/find_commits_action.rb', line 35 def self.tickets(log:, regex:) return [] if log.to_s.empty? log.each_line .map(&:strip) .grep(regex) .flatten .reject(&:empty?) .uniq end |