-
Notifications
You must be signed in to change notification settings - Fork 19
/
pronto
executable file
·42 lines (39 loc) · 986 Bytes
/
pronto
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
#!/usr/bin/env ruby
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
Dir.chdir(ENV.fetch('GITHUB_WORKSPACE', '/data')) do
Pronto::CLI.start
end