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 613d304..7def925 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 @@ -145,10 +145,7 @@ def self.create_subtask(token:, task_id:, assignee_id:, task_name:, notes: nil, subtask_options[:notes] = notes unless notes.nil? subtask_options[:html_notes] = html_notes unless html_notes.nil? - asana_client = Asana::Client.new do |c| - c.authentication(:access_token, token) - c.default_headers("Asana-Enable" => "new_goal_memberships,new_user_task_lists") - end + asana_client = Helper::AsanaHelper.make_asana_client(token) asana_client.tasks.create_subtask_for_task(**subtask_options) end end diff --git a/lib/fastlane/plugin/ddg_apple_automation/actions/asana_find_release_task_action.rb b/lib/fastlane/plugin/ddg_apple_automation/actions/asana_find_release_task_action.rb index a1d80d8..3cdf2ad 100644 --- a/lib/fastlane/plugin/ddg_apple_automation/actions/asana_find_release_task_action.rb +++ b/lib/fastlane/plugin/ddg_apple_automation/actions/asana_find_release_task_action.rb @@ -83,11 +83,7 @@ def self.validate_semver(version) end def self.find_release_task(version, asana_access_token) - asana_client = Asana::Client.new do |c| - c.authentication(:access_token, asana_access_token) - c.default_headers("Asana-Enable" => "new_goal_memberships,new_user_task_lists") - end - + asana_client = Helper::AsanaHelper.make_asana_client(asana_access_token) release_task_id = nil begin diff --git a/lib/fastlane/plugin/ddg_apple_automation/actions/asana_log_message_action.rb b/lib/fastlane/plugin/ddg_apple_automation/actions/asana_log_message_action.rb index 3e32b46..1ee44e6 100644 --- a/lib/fastlane/plugin/ddg_apple_automation/actions/asana_log_message_action.rb +++ b/lib/fastlane/plugin/ddg_apple_automation/actions/asana_log_message_action.rb @@ -21,10 +21,7 @@ def self.run(params) asana_user_id = find_asana_user_id(params) args[:assignee_id] = asana_user_id - asana_client = Asana::Client.new do |c| - c.authentication(:access_token, token) - c.default_headers("Asana-Enable" => "new_goal_memberships,new_user_task_lists") - end + asana_client = Helper::AsanaHelper.make_asana_client(token) begin UI.important("Adding user #{asana_user_id} as collaborator on release task's 'Automation' subtask") diff --git a/lib/fastlane/plugin/ddg_apple_automation/helper/asana_helper.rb b/lib/fastlane/plugin/ddg_apple_automation/helper/asana_helper.rb index 2659845..0e0e2ee 100644 --- a/lib/fastlane/plugin/ddg_apple_automation/helper/asana_helper.rb +++ b/lib/fastlane/plugin/ddg_apple_automation/helper/asana_helper.rb @@ -194,6 +194,14 @@ def self.create_release_task(platform, version, assignee_id, asana_access_token) task_id end + # Updates asana tasks for a release + # + # @param github_token [String] GitHub token + # @param asana_access_token [String] Asana access token + # @param release_task_id [String] Asana access token + # @param validation_section_id [String] ID of the 'Validation' section in the Asana project + # @param version [String] version number + # def self.update_asana_tasks_for_release(params) UI.message("Checking latest public release in GitHub") client = Octokit::Client.new(access_token: params[:github_token])