lib/unwrappr/github/client.rb in unwrappr-0.4.0 vs lib/unwrappr/github/client.rb in unwrappr-0.5.0

- old
+ new

@@ -28,18 +28,23 @@ end def create_and_annotate_pull_request pr = git_client.create_pull_request( repo_name_and_org, - 'master', + repo_default_branch, Unwrappr::GitCommandRunner.current_branch_name, 'Automated Bundle Update', pull_request_body ) annotate_pull_request(pr.number) end + def repo_default_branch + git_client.repository(repo_name_and_org) + .default_branch + end + def pull_request_body <<~BODY Gems brought up-to-date with :heart: by [Unwrappr](https://github.com/envato/unwrappr). See individual annotations below for details. BODY @@ -56,19 +61,19 @@ def git_client @git_client ||= Octokit::Client.new(access_token: github_token) end def github_token - @github_token ||= ENV.fetch('GITHUB_TOKEN') do - raise %( + @github_token ||= ENV.fetch('GITHUB_TOKEN') + rescue KeyError + raise %( Missing environment variable GITHUB_TOKEN. See https://github.com/settings/tokens to set up personal access tokens. Add to the environment: export GITHUB_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -) - end + ) end end end end end