From ed36636523ce0726b1fa541737288f51310071f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20=C5=81yp?= Date: Fri, 6 Sep 2024 10:01:34 +0200 Subject: [PATCH] Provide default value for WORKFLOW_URL env var --- .../actions/asana_add_comment_action.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 411a940..110dde1 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 @@ -14,6 +14,8 @@ def self.run(params) template_name = params[:template_name] comment = params[:comment] + workflow_url = ENV.fetch('WORKFLOW_URL', '') + begin validate_params(task_id, task_url, comment, template_name) rescue ArgumentError => e @@ -24,7 +26,7 @@ def self.run(params) task_id = Fastlane::Actions::AsanaExtractTaskIdAction.run(task_url: task_url) if task_url if template_name.to_s.empty? - text = "#{comment}\n\nWorkflow URL: #{ENV.fetch('WORKFLOW_URL')}" + text = "#{comment}\n\nWorkflow URL: #{workflow_url}" create_story(asana_access_token, task_id, text: text) else template_file = Helper::DdgAppleAutomationHelper.path_for_asset_file("asana_add_comment/templates/#{template_name}.html") @@ -89,7 +91,7 @@ def self.validate_params(task_id, task_url, comment, template_name) raise ArgumentError, "Both comment and template_name cannot be empty. At least one must be provided." end - if comment && ENV.fetch('WORKFLOW_URL').to_s.empty? + if comment && workflow_url.to_s.empty? raise ArgumentError, "If comment is provided, workflow_url cannot be empty" end end