class Fastlane::Actions::ReleaseNotesFromCommitsAction

Public Class Methods

author() click to toggle source
# File lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb, line 45
def self.author
  "Piotrek Dubiel"
end
available_options() click to toggle source
# File lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb, line 29
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :current_version,
                                 env_name: "",
                                 description: "Git ref of current version",
                                 optional: true,
                                 default_value: 'HEAD')
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb, line 25
def self.description
  "Extracts release notes from git commit messages since last tag"
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb, line 49
def self.is_supported?(platform)
  true
end
output() click to toggle source
# File lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb, line 39
def self.output
  [
    ['RELEASE_NOTES', 'Release notes extracted from git commits']
  ]
end
run(config) click to toggle source
# File lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb, line 8
def self.run(config)
  Fastlane::Polidea.session.action_launched("release_notes_from_commits", config)

  current_version = config[:current_version]
  previous_version = sh("git describe --abbrev=0 --tags #{current_version}^").strip
  messages = sh("git log --oneline --pretty=format:'%s' #{previous_version}..#{current_version} | grep -Ev '^Merge'").strip
  release_notes = messages.split("\n").map { |note| "- #{note}" }.join("\n")

  UI.success "Extracted release notes:\n#{release_notes}"
  Actions.lane_context[SharedValues::RELEASE_NOTES] = release_notes
  ENV[SharedValues::RELEASE_NOTES.to_s] = release_notes

  Fastlane::Polidea.session.action_completed("release_notes_from_commits")

  release_notes
end