9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/circleci/bundle/update/pr.rb', line 9
def self.create_if_needed(git_username: nil, git_email: nil)
raise "$CIRCLE_PROJECT_USERNAME isn't set" unless ENV['CIRCLE_PROJECT_USERNAME']
raise "$CIRCLE_PROJECT_REPONAME isn't set" unless ENV['CIRCLE_PROJECT_REPONAME']
raise "$GITHUB_ACCESS_TOKEN isn't set" unless ENV['GITHUB_ACCESS_TOKEN']
return unless need?
repo_full_name = "#{ENV['CIRCLE_PROJECT_USERNAME']}/#{ENV['CIRCLE_PROJECT_REPONAME']}"
now = Time.now
branch = "bundle-update-#{now.strftime('%Y%m%d')}"
create_branch(git_username, git_email, branch)
pull_request = create_pull_request(repo_full_name, branch, now)
(repo_full_name, pull_request[:number])
end
|