bump-formula-pr: use GitHub vars under env filter.

Ensure that the various variables are passed through and reset
correctly. If we end up doing this in a bunch of places we may add some
helpers to simplify this.
This commit is contained in:
Mike McQuaid 2017-11-05 20:30:52 +00:00
parent 2ad1799308
commit 3f8f2c6726
2 changed files with 10 additions and 1 deletions

View File

@ -117,6 +117,14 @@ module Homebrew
# user path, too.
ENV["PATH"] = ENV["HOMEBREW_PATH"]
# Setup GitHub environment variables
%w[GITHUB_USER GITHUB_PASSWORD GITHUB_TOKEN].each do |env|
homebrew_env = ENV["HOMEBREW_#{env}"]
next unless homebrew_env
next if homebrew_env.empty?
ENV[env] = homebrew_env
end
formula = ARGV.formulae.first
if formula

View File

@ -47,7 +47,8 @@ HOMEBREW_LIBRARY="$HOMEBREW_REPOSITORY/Library"
# Whitelist and copy to HOMEBREW_* all variables previously mentioned in
# manpage or used elsewhere by Homebrew.
for VAR in AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY BINTRAY_USER BINTRAY_KEY \
BROWSER EDITOR GIT PATH VISUAL
BROWSER EDITOR GIT PATH VISUAL \
GITHUB_USER GITHUB_PASSWORD GITHUB_TOKEN
do
# Skip if variable value is empty.
[[ -z "${!VAR}" ]] && continue