forked from renatolond/pronto-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpronto
More file actions
executable file
·47 lines (43 loc) · 1.2 KB
/
pronto
File metadata and controls
executable file
·47 lines (43 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env ruby
# frozen_string_literal: true
system("git config --global --add safe.directory #{ENV.fetch("GITHUB_WORKSPACE", nil)}")
require "rubygems"
require "bundler/setup"
Bundler.require(:default)
require_relative "src/github_action_check_run_formatter"
require "pronto/cli"
# github action inputs can only be strings, so when we passes the runners
# list to this container, github passes container command args quoted like this:
# `docker run ... "run" "-r" "rubocop rails_schema" ...`
# and this fails parsing by thor with:
# `require': cannot load such file -- pronto/rubocop rails_schema (LoadError)`
# so the couple lines below turn ARGV like this:
# ```
# run
# -r
# rubocop rails_schema
# ````
#
# into this:
#
# ```
# run
# -r
# rubocop
# rails_schema
# ```
#
# which works correctly
if ARGV.include?("-r")
runners_index = ARGV.index("-r") + 1
runners = ARGV.at(runners_index)
if runners.include?(" ")
ARGV.delete_at(runners_index)
ARGV.insert(runners_index, runners.split)
end
end
pronto_target_path = ENV.fetch("PRONTO_TARGET_PATH", nil)
pronto_target_path = ENV.fetch("GITHUB_WORKSPACE", "/data") if pronto_target_path.nil?
Dir.chdir(pronto_target_path) do
Pronto::CLI.start
end