Skip to content

Commit

Permalink
Provide default value for WORKFLOW_URL env var
Browse files Browse the repository at this point in the history
  • Loading branch information
jaceklyp committed Sep 6, 2024
1 parent 5942f55 commit ed36636
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ed36636

Please sign in to comment.