-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add asana_extract_task_assignee action
- Loading branch information
Showing
5 changed files
with
75 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
lib/fastlane/plugin/ddg_release_automation/actions/asana_extract_task_assignee_action.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
require "fastlane/action" | ||
require "fastlane_core/configuration/config_item" | ||
require "httparty" | ||
require "json" | ||
require_relative "../helper/ddg_release_automation_helper" | ||
require_relative "../helper/github_actions_helper" | ||
|
||
module Fastlane | ||
module Actions | ||
class AsanaExtractTaskAssigneeAction < Action | ||
def self.run(params) | ||
task_id = params[:task_id] | ||
token = Helper::DdgReleaseAutomationHelper.fetch_asana_token | ||
url = Helper::DdgReleaseAutomationHelper::ASANA_API_URL + "/tasks/#{task_id}?opt_fields=assignee" | ||
|
||
response = HTTParty.get(url, headers: { 'Authorization' => "Bearer #{token}" }) | ||
|
||
if response.success? | ||
assignee_id = response.parsed_response.dig('data', 'assignee', 'gid') | ||
else | ||
UI.user_error!("Failed to fetch task assignee: (#{response.code} #{response.message})") | ||
end | ||
|
||
if Helper.is_ci? | ||
Helper::GitHubActionsHelper.set_output("asana_assignee_id", assignee_id) | ||
end | ||
|
||
assignee_id | ||
end | ||
|
||
def self.description | ||
"This action checks Asana task assignee ID for a provided task ID" | ||
end | ||
|
||
def self.authors | ||
["DuckDuckGo"] | ||
end | ||
|
||
def self.return_value | ||
"The assignee ID extracted from the Asana task" | ||
end | ||
|
||
def self.details | ||
# Optional: | ||
"" | ||
end | ||
|
||
def self.available_options | ||
[ | ||
FastlaneCore::ConfigItem.new(key: :task_id, | ||
description: "Asana task ID", | ||
optional: false, | ||
type: String) | ||
] | ||
end | ||
|
||
def self.is_supported?(platform) | ||
true | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters