Skip to content

Commit e86e969

Browse files
ljones140Copilot
andauthored
Update scripts/scan_pr_lib.rb
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 85c8e53 commit e86e969

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

scripts/scan_pr_lib.rb

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,22 @@ def execute_dependency_review(repo_nwo, event_file)
104104
"GITHUB_STEP_SUMMARY" => "/dev/null"
105105
}
106106

107-
# bash does not like variable names with dashes like the ones Actions
108-
# uses (e.g. INPUT_REPO-TOKEN). Passing them through `env` instead of
109-
# manually setting them does the job.
110-
action_inputs_env_str = action_inputs.map { |name, value| "\"INPUT_#{name.upcase}=#{value}\"" }.join(" ")
111-
dev_cmd = "./node_modules/.bin/nodemon --exec \"env #{action_inputs_env_str} node -r esbuild-register\" src/main.ts"
112-
113-
Open3.popen2e(dev_cmd_env, dev_cmd) do |stdin, out|
107+
# Merge action inputs into environment, formatting keys as INPUT_...
108+
action_inputs_env = action_inputs.each_with_object({}) do |(name, value), h|
109+
h["INPUT_#{name.to_s.upcase}"] = value unless value.nil?
110+
end
111+
env = dev_cmd_env.merge(action_inputs_env)
112+
113+
dev_cmd = [
114+
"./node_modules/.bin/nodemon",
115+
"--exec",
116+
"node",
117+
"-r",
118+
"esbuild-register",
119+
"src/main.ts"
120+
]
121+
122+
Open3.popen2e(env, *dev_cmd) do |stdin, out|
114123
while line = out.gets
115124
puts line.gsub(@github_token, "<REDACTED>")
116125
end

0 commit comments

Comments
 (0)