class Fastlane::Actions::EmojifyChangelogAction
Constants
- SUBSECTION_IDENTIFIERS
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/changelog/actions/emojify_changelog.rb, line 77 def self.available_options [] end
description()
click to toggle source
@!group Documentation
# File lib/fastlane/plugin/changelog/actions/emojify_changelog.rb, line 69 def self.description "Emojifies the output of read_changelog action" end
details()
click to toggle source
# File lib/fastlane/plugin/changelog/actions/emojify_changelog.rb, line 73 def self.details "This action uses the output of read_changelog action to append an emoji to known subsections" end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/changelog/actions/emojify_changelog.rb, line 91 def self.is_supported?(platform) true end
output()
click to toggle source
# File lib/fastlane/plugin/changelog/actions/emojify_changelog.rb, line 81 def self.output [ ['EMOJIFY_CHANGELOG_CONTENT', 'Contains the emojified content of the last read_changelog action'], ] end
run(params)
click to toggle source
# File lib/fastlane/plugin/changelog/actions/emojify_changelog.rb, line 10 def self.run(params) UI.message "Emojifying the output of read_changelog action" read_changelog_output = lane_context[SharedValues::READ_CHANGELOG_SECTION_CONTENT] changelog_path = lane_context[SharedValues::READ_CHANGELOG_CHANGELOG_PATH] line_separator = Helper::ChangelogHelper.get_line_separator(changelog_path) emojified_content = "" # Read through read changelog output string read_changelog_output.each_line do |line| # Remove leading or trailing whitespaces stripped = line.strip # Remove trailing colon (if any) if stripped.end_with?(':') stripped.chop! chopped_colon = true end if SUBSECTION_IDENTIFIERS.include?(stripped) emojified_string = case stripped when 'Added' then '*Added* 🎁' when 'Changed' then '*Changed* ↔️' when 'Fixed' then '*Fixed* ✅' when 'Removed' then '*Removed* 🚫' when 'Work In Progress' then '*Work In Progress* 🚧' when 'Security' then '*Security* 🔒' when 'Deprecated' then '*Deprecated* 💨' end # Add back trailing colon, if previously removed if chopped_colon emojified_string.concat(':') end # Add line break to the end of the string, in order to start next line on the next line emojified_string.concat(line_separator) # Output updated line emojified_content.concat(emojified_string) else # Output updated line # Replace '-' with '*' if line.start_with?('-') line[0] = '•' end emojified_content.concat(line) end end UI.success("Successfully emojified output of read_changelog action") Actions.lane_context[SharedValues::EMOJIFY_CHANGELOG_CONTENT] = emojified_content end