Class: Fastlane::Actions::EnGitChangelogAction

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

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



55
56
57
# File 'lib/fastlane/plugin/ciutils/actions/en_git_changelog.rb', line 55

def self.authors
  ["Nicolae Ghimbovschi"]
end

.available_optionsObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/fastlane/plugin/ciutils/actions/en_git_changelog.rb', line 39

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :from_commit,
                                 env_name: "FL_EN_GIT_FROM_COMMIT",
                                 description: "Commit from where to start the log. Default value is ENV['GIT_PREVIOUS_SUCCESSFUL_COMMIT']",
                                 default_value: ENV['GIT_PREVIOUS_SUCCESSFUL_COMMIT']),
    FastlaneCore::ConfigItem.new(key: :to_commit,
                                 env_name: "FL_EN_GIT_TO_COMMIT",
                                 description: "The last commit included in the log. Default value is ENV['GIT_COMMIT']",
                                 default_value: ENV['GIT_COMMIT']),
    FastlaneCore::ConfigItem.new(key: :filter,
                                 env_name: "FL_EN_TASK_PREFIX_FILTER",
                                 description: "The prefix/string to look in the commit message (e.g. JIRA task prefix)")
  ]
end

.descriptionObject



30
31
32
# File 'lib/fastlane/plugin/ciutils/actions/en_git_changelog.rb', line 30

def self.description
  "Creates a change log from git commits by filtering commits by a pattern (e.g. JIRA task prefix)"
end

.detailsObject



34
35
36
37
# File 'lib/fastlane/plugin/ciutils/actions/en_git_changelog.rb', line 34

def self.details
  "You can use this action to do create a git changelog with tasks id.
It also sets the result to EN_CHANGELOG, FL_HOCKEY_NOTES, PILOT_CHANGELOG and CRASHLYTICS_NOTES"
end

.git_log_between(from_commit, to_commit, filter) ⇒ Object



14
15
16
17
# File 'lib/fastlane/plugin/ciutils/actions/en_git_changelog.rb', line 14

def self.git_log_between(from_commit, to_commit, filter)
  change_log = `git log #{from_commit}...#{to_commit} --no-merges | grep #{filter} | sed -e 's/^[[:space:]]*//' | sed 's/\\[//'| sed 's/\\]//' | sort -r -u`
  change_log
end

.inject_env_with_changelog(change_log) ⇒ Object



19
20
21
22
23
24
# File 'lib/fastlane/plugin/ciutils/actions/en_git_changelog.rb', line 19

def self.inject_env_with_changelog(change_log)
  ENV['EN_CHANGELOG'] = change_log
  ENV['FL_HOCKEY_NOTES'] = change_log
  ENV['PILOT_CHANGELOG'] = change_log
  ENV['CRASHLYTICS_NOTES'] = change_log
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/fastlane/plugin/ciutils/actions/en_git_changelog.rb', line 59

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/fastlane/plugin/ciutils/actions/en_git_changelog.rb', line 4

def self.run(params)
  from_commit = params[:from_commit]
  to_commit = params[:to_commit]
  filter = params[:filter]

  change_log = self.git_log_between(from_commit, to_commit, filter)
  self.inject_env_with_changelog(change_log)
  change_log
end