Sha256: 095f4e97d2f80fa25b56022c0d353babe8d68021130b911f18e681444e7260df

Contents?: true

Size: 1.65 KB

Versions: 12

Compression:

Stored size: 1.65 KB

Contents

module Fastlane
  module Actions
    module SharedValues
      RELEASE_NOTES = :RELEASE_NOTES
    end

    class ReleaseNotesFromCommitsAction < Action
      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

      def self.description
        "Extracts release notes from git commit messages since last tag"
      end

      def self.available_options
        [
          FastlaneCore::ConfigItem.new(key: :current_version,
                                       env_name: "",
                                       description: "Git ref of current version",
                                       optional: true,
                                       default_value: 'HEAD')
        ]
      end

      def self.output
        [
          ['RELEASE_NOTES', 'Release notes extracted from git commits']
        ]
      end

      def self.author
        "Piotrek Dubiel"
      end

      def self.is_supported?(platform)
        true
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
fastlane-plugin-polidea-4.0.1 lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb
fastlane-plugin-polidea-4.0.1.pre lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb
fastlane-plugin-polidea-4.0.0 lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb
fastlane-plugin-polidea-4.0.0.pre.3 lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb
fastlane-plugin-polidea-3.0.1 lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb
fastlane-plugin-polidea-4.0.0.pre.2 lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb
fastlane-plugin-polidea-4.0.0.pre.1 lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb
fastlane-plugin-polidea-4.0.0.pre lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb
fastlane-plugin-polidea-3.0.0 lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb
fastlane-plugin-polidea-3.0.0.pre.2 lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb
fastlane-plugin-polidea-3.0.0.pre.1 lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb
fastlane-plugin-polidea-2.2.0.pre.1 lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb