Skip to content

Commit

Permalink
clean up run input path checks
Browse files Browse the repository at this point in the history
  • Loading branch information
smonn committed Oct 17, 2024
1 parent 8a94de8 commit 70e5591
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions lib/fastlane/plugin/qawolf/actions/notify_deploy_qawolf_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ class NotifyDeployQawolfAction < Action
def self.run(params)
qawolf_api_key = params[:qawolf_api_key] # Required
qawolf_base_url = params[:qawolf_base_url]
run_input_path = params[:run_input_path] || Actions.lane_context[SharedValues::QAWOLF_RUN_INPUT_PATH]

if run_input_path.nil?
UI.user_error!("🐺 No run input path found. Please run the `upload_to_qawolf` action first or set the `run_input_path` option.")
end

if params[:run_input_path].nil? == false && Actions.lane_context[SharedValues::QAWOLF_RUN_INPUT_PATH].nil? == false
UI.important("🐺 Both `run_input_path` and `QAWOLF_RUN_INPUT_PATH` are set. Using `run_input_path`.")
end

UI.message("🐺 Calling QA Wolf deploy success webhook...")

Expand All @@ -36,7 +27,7 @@ def self.run(params)
hosting_service: params[:hosting_service],
sha: params[:sha],
variables: variables.merge({
RUN_INPUT_PATH: run_input_path
RUN_INPUT_PATH: run_input_path(params)
})
}

Expand All @@ -50,6 +41,14 @@ def self.run(params)
Actions.lane_context[SharedValues::QAWOLF_RUN_ID] = run_id
end

def self.run_input_path(params)
if params[:run_input_path].nil?
UI.user_error!("🐺 No run input path found. Please run the `upload_to_qawolf` action first or set the `run_input_path` option.")
end

return params[:run_input_path]
end

def self.description
"Fastlane plugin for QA Wolf integration to trigger test runs."
end
Expand Down

0 comments on commit 70e5591

Please sign in to comment.