Skip to content

Commit

Permalink
Globally replace all vars without defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Nov 22, 2023
1 parent d4b716b commit a6533d1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions npm_and_yarn/lib/dependabot/npm_and_yarn/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,13 @@ def self.yarn_major_version

message = e.message

missing_env_var_regex = %r{Environment variable not found \((?<variable>[^)]+)\) in #{Dir.pwd}/(?<path>\S+)}
missing_env_var_regex = %r{Environment variable not found \((?:[^)]+)\) in #{Dir.pwd}/(?<path>\S+)}

if message.match?(missing_env_var_regex)
match = T.must(message.match(missing_env_var_regex))
variable = T.must(match.named_captures["variable"])
path = T.must(match.named_captures["path"])

File.write(path, File.read(path).gsub("${#{variable}}", ""))
File.write(path, File.read(path).gsub(/\$\{[^}-]+\}/, ""))
retries = T.must(retries) + 1

retry
Expand Down

0 comments on commit a6533d1

Please sign in to comment.