diff --git a/lib/fastlane/plugin/ddg_apple_automation/actions/asana_add_comment_action.rb b/lib/fastlane/plugin/ddg_apple_automation/actions/asana_add_comment_action.rb index f327ba0..d2aaa13 100644 --- a/lib/fastlane/plugin/ddg_apple_automation/actions/asana_add_comment_action.rb +++ b/lib/fastlane/plugin/ddg_apple_automation/actions/asana_add_comment_action.rb @@ -33,7 +33,7 @@ def self.run(params) template_content = Helper::DdgAppleAutomationHelper.load_file(template_file) return unless template_content - html_text = Helper::DdgAppleAutomationHelper.sanitize_and_replace_env_vars(template_content) + html_text = Helper::DdgAppleAutomationHelper.sanitize_html_and_replace_env_vars(template_content) create_story(asana_access_token, task_id, html_text: html_text) end end diff --git a/lib/fastlane/plugin/ddg_apple_automation/actions/asana_create_action_item_action.rb b/lib/fastlane/plugin/ddg_apple_automation/actions/asana_create_action_item_action.rb index 79dbd6f..7d0097f 100644 --- a/lib/fastlane/plugin/ddg_apple_automation/actions/asana_create_action_item_action.rb +++ b/lib/fastlane/plugin/ddg_apple_automation/actions/asana_create_action_item_action.rb @@ -40,8 +40,8 @@ def self.run(params) if template_name template_file = Helper::DdgAppleAutomationHelper.path_for_asset_file("asana_create_action_item/templates/#{template_name}.yml") template_content = YAML.safe_load(Helper::DdgAppleAutomationHelper.load_file(template_file)) - task_name = Helper::DdgAppleAutomationHelper.sanitize_and_replace_env_vars(template_content["name"]) - html_notes = Helper::DdgAppleAutomationHelper.sanitize_and_replace_env_vars(template_content["html_notes"]) + task_name = Helper::DdgAppleAutomationHelper.sanitize_html_and_replace_env_vars(template_content["name"]) + html_notes = Helper::DdgAppleAutomationHelper.sanitize_html_and_replace_env_vars(template_content["html_notes"]) end begin diff --git a/lib/fastlane/plugin/ddg_apple_automation/helper/ddg_apple_automation_helper.rb b/lib/fastlane/plugin/ddg_apple_automation/helper/ddg_apple_automation_helper.rb index 362e994..d8b30e8 100644 --- a/lib/fastlane/plugin/ddg_apple_automation/helper/ddg_apple_automation_helper.rb +++ b/lib/fastlane/plugin/ddg_apple_automation/helper/ddg_apple_automation_helper.rb @@ -28,7 +28,7 @@ def self.load_file(file) UI.user_error!("Error: The file '#{file}' does not exist.") end - def self.sanitize_and_replace_env_vars(content) + def self.sanitize_html_and_replace_env_vars(content) content.gsub(/\$\{(\w+)\}/) { ENV.fetch($1, '') } # replace environment variables .gsub(/\s+/, ' ') # replace multiple whitespaces with a single space .gsub(/>\s+, '><') # remove spaces between HTML tags diff --git a/spec/ddg_apple_automation_helper_spec.rb b/spec/ddg_apple_automation_helper_spec.rb index bad0ccf..f6ec551 100644 --- a/spec/ddg_apple_automation_helper_spec.rb +++ b/spec/ddg_apple_automation_helper_spec.rb @@ -31,39 +31,39 @@ def load_file(file) end end - describe "#sanitize_and_replace_env_vars" do + describe "#sanitize_html_and_replace_env_vars" do it "substitutes all env variables" do content = "