Class: Fastlane::Actions::ReadChangelogAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::ReadChangelogAction
- Defined in:
- lib/fastlane/plugin/stream_actions/actions/read_changelog.rb
Documentation collapse
Class Method Summary collapse
Class Method Details
.available_options ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/fastlane/plugin/stream_actions/actions/read_changelog.rb', line 38 def self. [ FastlaneCore::ConfigItem.new( key: :version, description: 'Release version', verify_block: proc do |v| UI.user_error!("You need to pass the version of the release you want to obtain the changelog from") if v.nil? || v.empty? end ), FastlaneCore::ConfigItem.new( key: :changelog_path, env_name: 'FL_CHANGELOG_PATH', description: 'The path to your project CHANGELOG.md', is_string: true, default_value: './CHANGELOG.md', optional: true ), FastlaneCore::ConfigItem.new( key: :default_changes, description: 'The default changelog entry if no changes provided', is_string: true, default_value: '- Bug fixes and improvements', optional: true ) ] end |
.description ⇒ Object
34 35 36 |
# File 'lib/fastlane/plugin/stream_actions/actions/read_changelog.rb', line 34 def self.description 'Gets updates from the CHANGELOG.md' end |
.is_supported?(platform) ⇒ Boolean
65 66 67 |
# File 'lib/fastlane/plugin/stream_actions/actions/read_changelog.rb', line 65 def self.is_supported?(platform) true end |
.run(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fastlane/plugin/stream_actions/actions/read_changelog.rb', line 4 def self.run(params) UI.("Getting changelog for #{params[:version]}") changes = '' start_token = '# ' version_found = false File.readlines(params[:changelog_path]).each do |line| unless version_found version_found = line.start_with?("#{start_token}#{params[:version]}") || line.start_with?("#{start_token}[#{params[:version]}") next end break if line.start_with?(start_token) changes << line end if changes.strip.empty? changes = params[:default_changes] UI.important("No changelog found for #{params[:version]}, using default: \n#{changes}") else UI.success("Changelog for #{params[:version]}: \n#{changes}") end changes end |