lib/circleci/bundle/update/pr.rb in circleci-bundle-update-pr-1.9.1 vs lib/circleci/bundle/update/pr.rb in circleci-bundle-update-pr-1.10.0
- old
+ new
@@ -4,11 +4,11 @@
module Circleci
module Bundle
module Update
module Pr
- def self.create_if_needed(git_username: nil, git_email: nil, git_branches: ["master"])
+ def self.create_if_needed(git_username: nil, git_email: nil, git_branches: ["master"], assignees: [])
raise_if_env_unvalid!
return unless need?(git_branches)
repo_full_name = "#{ENV['CIRCLE_PROJECT_USERNAME']}/#{ENV['CIRCLE_PROJECT_REPONAME']}"
now = Time.now
branch = "bundle-update-#{now.strftime('%Y%m%d%H%M%S')}"
@@ -17,10 +17,11 @@
git_email ||= "#{git_username}@users.noreply.#{github_host}"
create_branch(git_username, git_email, branch, repo_full_name)
pull_request = create_pull_request(repo_full_name, branch, now)
add_comment_of_compare_linker(repo_full_name, pull_request[:number])
+ add_assignees(repo_full_name, pull_request[:number], assignees) unless assignees.empty?
end
def self.need?(git_branches)
return false unless git_branches.include?(ENV['CIRCLE_BRANCH'])
unless system("bundle update && bundle update --ruby")
@@ -63,9 +64,14 @@
Powered by [compare_linker](https://rubygems.org/gems/compare_linker)
EOC
compare_linker.add_comment(repo_full_name, pr_number, comment)
end
private_class_method :add_comment_of_compare_linker
+
+ def self.add_assignees(repo_full_name, pr_number, assignees)
+ client.add_assignees(repo_full_name, pr_number, assignees)
+ end
+ private_class_method :add_assignees
def self.client
if enterprise?
Octokit::Client.new(access_token: ENV['ENTERPRISE_OCTOKIT_ACCESS_TOKEN'],
api_endpoint: ENV['ENTERPRISE_OCTOKIT_API_ENDPOINT'])