Skip to content

Commit

Permalink
fix up bad merge
Browse files Browse the repository at this point in the history
  • Loading branch information
kshann committed Nov 22, 2024
1 parent 3cedec5 commit 70278f3
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
require "fastlane/action"
require "fastlane_core/configuration/config_item"

module Fastlane
module Actions
class TestDoThingsAction < Action
def self.run(params)
puts("oh yeah!") unless params[:is_hotfix]
end

def self.description
"Uploads a file to an Asana task"
end

def self.authors
["DuckDuckGo"]
end

def self.return_value
""
end

def self.details
# Optional:
""
end

def self.available_options
[
FastlaneCore::ConfigItem.new(key: :is_hotfix,
description: "Asana task ID",
optional: true,
type: Boolean,
default_value: false)
]
end

def self.is_supported?(platform)
true
end
end
end
end
26 changes: 24 additions & 2 deletions lib/fastlane/plugin/ddg_apple_automation/helper/asana_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def self.extract_asana_task_assignee(task_id, asana_access_token)
client = make_asana_client(asana_access_token)

begin
task = client.tasks.get_task(task_gid: task_id, options: { opt_fields: ["assignee"] })
task = client.tasks.get_task(task_gid: task_id, options: { fields: ["assignee"] })
rescue StandardError => e
UI.user_error!("Failed to fetch task assignee: #{e}")
return
Expand All @@ -90,7 +90,7 @@ def self.get_release_automation_subtask_id(task_url, asana_access_token)
asana_client = make_asana_client(asana_access_token)

begin
subtasks = asana_client.tasks.get_subtasks_for_task(task_gid: task_id, options: { opt_fields: ["name", "created_at"] })
subtasks = asana_client.tasks.get_subtasks_for_task(task_gid: task_id, options: { fields: ["name", "created_at"] })
rescue StandardError => e
UI.user_error!("Failed to fetch 'Automation' subtasks for task #{task_id}: #{e}")
return
Expand Down Expand Up @@ -432,6 +432,28 @@ def self.sanitize_asana_html_notes(content)
.gsub(%r{<br\s*/?>}, "\n") # replace <br> tags with newlines
end

def self.get_task_ids_from_git_log(from_ref, to_ref = "HEAD")
git_log = `git log #{from_ref}..#{to_ref}`

git_log
.gsub("\n", " ")
.scan(%r{\bTask/Issue URL:.*?https://app\.asana\.com[/0-9f]+\b})
.map { |task_line| task_line.gsub(/.*(https.*)/, '\1') }
.map { |task_url| extract_asana_task_id(task_url, set_gha_output: false) }
end

def self.fetch_release_notes(release_task_id, asana_access_token, output_type: "asana")
asana_client = make_asana_client(asana_access_token)
release_task_body = asana_client.tasks.get_task(task_gid: release_task_id, options: { fields: ["notes"] }).notes
ReleaseTaskHelper.extract_release_notes(release_task_body, output_type: output_type)
end

def self.fetch_release_notes(release_task_id, asana_access_token, output_type: "asana")
asana_client = make_asana_client(asana_access_token)
release_task_body = asana_client.tasks.get_task(task_gid: release_task_id, options: { fields: ["notes"] }).notes
ReleaseTaskHelper.extract_release_notes(release_task_body, output_type: output_type)
end

def self.construct_this_release_includes(task_ids)
return '' if task_ids.empty?

Expand Down

0 comments on commit 70278f3

Please sign in to comment.