fastlane/lib/fastlane/actions/create_pull_request.rb in fastlane-2.122.0.beta.20190502200046 vs fastlane/lib/fastlane/actions/create_pull_request.rb in fastlane-2.122.0
- old
+ new
@@ -34,10 +34,13 @@
UI.success("Successfully created pull request ##{number}. You can see it at '#{html_url}'")
# Add labels to pull request
add_labels(params, number) if params[:labels]
+ # Add assignees to pull request
+ add_assignees(params, number) if params[:assignees]
+
Actions.lane_context[SharedValues::CREATE_PULL_REQUEST_HTML_URL] = html_url
return html_url
end
end
@@ -58,10 +61,29 @@
end
}
)
end
+ def self.add_assignees(params, number)
+ payload = {
+ 'assignees' => params[:assignees]
+ }
+ GithubApiAction.run(
+ server_url: params[:api_url],
+ api_token: params[:api_token],
+ http_method: 'POST',
+ path: "repos/#{params[:repo]}/issues/#{number}/assignees",
+ body: payload,
+ error_handlers: {
+ '*' => proc do |result|
+ UI.error("GitHub responded with #{result[:status]}: #{result[:body]}")
+ return nil
+ end
+ }
+ )
+ end
+
#####################################################
# @!group Documentation
#####################################################
def self.description
@@ -123,15 +145,20 @@
env_name: "GITHUB_PULL_REQUEST_API_URL",
description: "The URL of GitHub API - used when the Enterprise (default to `https://api.github.com`)",
is_string: true,
code_gen_default_value: 'https://api.github.com',
default_value: 'https://api.github.com',
+ optional: true),
+ FastlaneCore::ConfigItem.new(key: :assignees,
+ env_name: "GITHUB_PULL_REQUEST_ASSIGNEES",
+ description: "The assignees for the pull request",
+ type: Array,
optional: true)
]
end
def self.author
- ["seei", "tommeier"]
+ ["seei", "tommeier", "marumemomo"]
end
def self.is_supported?(platform)
return true
end