Merge pull request #240 from actions/hm/fix-scan_pr
Fix passing repo-token input in scan_pr script
This commit is contained in:
+15
-7
@@ -32,17 +32,25 @@ event_file = Tempfile.new
|
|||||||
event_file.write("{ \"pull_request\": #{pr.to_h.to_json}}")
|
event_file.write("{ \"pull_request\": #{pr.to_h.to_json}}")
|
||||||
event_file.close
|
event_file.close
|
||||||
|
|
||||||
dev_cmd_env = {
|
action_inputs = {
|
||||||
"INPUT_REPO-TOKEN" => github_token,
|
"repo-token" => github_token
|
||||||
"GITHUB_REPOSITORY" => repo_nwo,
|
|
||||||
"GITHUB_EVENT_NAME" => "pull_request",
|
|
||||||
"GITHUB_EVENT_PATH" => event_file.path
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_cmd = "./node_modules/.bin/nodemon --exec \"node -r esbuild-register\" src/main.ts"
|
dev_cmd_env = {
|
||||||
|
"GITHUB_REPOSITORY" => repo_nwo,
|
||||||
|
"GITHUB_EVENT_NAME" => "pull_request",
|
||||||
|
"GITHUB_EVENT_PATH" => event_file.path,
|
||||||
|
"GITHUB_STEP_SUMMARY" => "/dev/null"
|
||||||
|
}
|
||||||
|
|
||||||
|
# bash does not like variable names with dashes like the ones Actions
|
||||||
|
# uses (e.g. INPUT_REPO-TOKEN). Passing them through `env` instead of
|
||||||
|
# manually setting them does the job.
|
||||||
|
action_inputs_env_str = action_inputs.map { |name, value| "\"INPUT_#{name.upcase}=#{value}\"" }.join(" ")
|
||||||
|
dev_cmd = "./node_modules/.bin/nodemon --exec \"env #{action_inputs_env_str} node -r esbuild-register\" src/main.ts"
|
||||||
|
|
||||||
Open3.popen2e(dev_cmd_env, dev_cmd) do |stdin, out|
|
Open3.popen2e(dev_cmd_env, dev_cmd) do |stdin, out|
|
||||||
while line = out.gets
|
while line = out.gets
|
||||||
puts line
|
puts line.gsub(github_token, "<REDACTED>")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user