-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathgitarro.rb
executable file
·39 lines (30 loc) · 1.08 KB
/
gitarro.rb
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
#!/usr/bin/ruby
require 'English'
require 'octokit'
require 'optparse'
require_relative 'lib/gitarro/opt_parser'
require_relative 'lib/gitarro/git_op'
require_relative 'lib/gitarro/backend'
b = Backend.new
prs = b.required_prs
exit 0 if prs.empty?
prs.each do |pr|
puts '=' * 30 + "\n" + "TITLE_PR: #{pr.title}, NR: #{pr.number}"
puts "DESCRIPTION:\n#{pr.body}\n" + '=' * 30
# check if prs contains the branch given otherwise just break
next unless b.pr_equal_specific_branch?(pr)
# this check the last commit state, catch for review or not reviewd status.
comm_st = b.client.status(b.repo, pr.head.sha)
# force test without any filter or check
break if b.force_run_test(pr)
# retrigger if magic word found
b.retrigger_check(pr)
# 0) do test for unreviewed pr
break if b.unreviewed_new_pr?(pr, comm_st)
# we run the test in 2 conditions:
# 1) the context is not set, test didnt run
# 2) the pending status is set on commit, repeat always when pending set
# check the conditions 1,2 and it they happens run_test
break if b.reviewed_pr?(comm_st, pr)
end
STDOUT.flush