Module: Circleci::Bundle::Update::Pr
- Defined in:
- lib/circleci/bundle/update/pr.rb,
lib/circleci/bundle/update/pr/note.rb,
lib/circleci/bundle/update/pr/version.rb
Defined Under Namespace
Modules: Note
Constant Summary collapse
- BRANCH_PREFIX =
ENV.fetch('BRANCH_PREFIX', nil) || 'bundle-update-'.freeze
- TITLE_PREFIX =
ENV.fetch('TITLE_PREFIX', nil) || 'bundle update at '.freeze
- VERSION =
'5.0.9'
Class Method Summary collapse
Class Method Details
.create_if_needed(git_username: nil, git_email: nil, git_branches: %w[master main],, assignees: nil, reviewers: nil, labels: nil, allow_dup_pr: false) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/circleci/bundle/update/pr.rb', line 10 def self.create_if_needed(git_username: nil, git_email: nil, git_branches: %w[master main], assignees: nil, reviewers: nil, labels: nil, allow_dup_pr: false) raise_if_env_unvalid! if skip?(allow_dup_pr) puts 'Skip because it has already existed.' return end unless target_branch?(running_branch: ENV.fetch('CIRCLE_BRANCH', nil), target_branches: git_branches) puts "Skip because CIRCLE_BRANCH[#{ENV.fetch('CIRCLE_BRANCH', nil)}] is not included in target branches[#{git_branches.join(',')}]." return end unless need_to_commit? puts 'No changes due to bundle update' return end git_username ||= client.user.login git_email ||= "#{git_username}@users.noreply.#{github_host}" branch = create_branch(git_username, git_email) pull_request = create_pull_request(branch) add_labels(pull_request[:number], labels) if labels update_pull_request_body(pull_request[:number]) add_assignees(pull_request[:number], assignees) if assignees request_review(pull_request[:number], reviewers) if reviewers end |