Merge pull request #3427 from MikeMcQuaid/bump-formula-pr-env-filtering-github

bump-formula-pr: use GitHub vars under env filter.
This commit is contained in:
Mike McQuaid 2017-11-07 08:12:53 +00:00 committed by GitHub
commit 3ad4dcafd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 3 deletions

View File

@ -117,6 +117,17 @@ module Homebrew
# user path, too.
ENV["PATH"] = ENV["HOMEBREW_PATH"]
# Use the user's browser, too.
ENV["BROWSER"] = ENV["HOMEBREW_BROWSER"]
# 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

@ -29,7 +29,7 @@ module EnvActivation
def clear_sensitive_environment!
ENV.each_key do |key|
next unless /(cookie|key|token)/i =~ key
next unless /(cookie|key|token|password)/i =~ key
ENV.delete key
end
end

View File

@ -207,7 +207,7 @@ class SystemConfig
next unless key.start_with?("HOMEBREW_")
next if boring_keys.include?(key)
next if defaults_hash[key.to_sym] == value
value = "set" if key =~ /(cookie|key|token)/i
value = "set" if key =~ /(cookie|key|token|password)/i
f.puts "#{key}: #{value}"
end
f.puts hardware if hardware

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