Skip to content

Commit 7986ff1

Browse files
paverajurre
authored andcommitted
The whole command needs a guard
1 parent 02d7414 commit 7986ff1

File tree

1 file changed

+6
-2
lines changed
  • npm_and_yarn/lib/dependabot/npm_and_yarn

1 file changed

+6
-2
lines changed

npm_and_yarn/lib/dependabot/npm_and_yarn/helpers.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ def self.npm_version_numeric(lockfile_content)
2323
def self.run_yarn_commands(*commands)
2424
# We never want to execute postinstall scripts
2525
SharedHelpers.run_shell_command("yarn config set enableScripts false")
26-
SharedHelpers.run_shell_command("yarn config set httpProxy #{ENV.fetch('HTTP_PROXY', '')}")
27-
SharedHelpers.run_shell_command("yarn config set httpsProxy #{ENV.fetch('HTTPS_PROXY', '')}")
26+
if (http_proxy = ENV.fetch("HTTP_PROXY", false))
27+
SharedHelpers.run_shell_command("yarn config set httpProxy #{http_proxy}")
28+
end
29+
if (https_proxy = ENV.fetch("HTTPS_PROXY", false))
30+
SharedHelpers.run_shell_command("yarn config set httpsProxy #{https_proxy}")
31+
end
2832
commands.each { |cmd| SharedHelpers.run_shell_command(cmd) }
2933
end
3034
end

0 commit comments

Comments
 (0)