Created
October 5, 2017 11:46
-
-
Save MalloZup/4a419bdcd090bdd90aff70dfcf28f2b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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.open_newer_prs | |
exit 0 if b.pr_list_empty?(prs) | |
puts 'before' | |
puts b.client.rate_limit.remaining | |
puts | |
prs.each do |pr| | |
puts '=' * 30 + "\n" + "TITLE_PR: #{pr.title}, NR: #{pr.number}\n" + '=' * 30 | |
# this check the last commit state, catch for review or not reviewd status. | |
comm_st = b.client.status(b.repo, pr.head.sha) | |
# pr number trigger. | |
break if b.trigger_by_pr_number(pr) | |
# retrigger if magic word found | |
b.retrigger_check(pr) | |
# check if changelog test was enabled | |
break if b.changelog_active(pr, comm_st) | |
# 0) do test for unreviewed pr | |
break if b.unreviewed_pr_test(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_test(comm_st, pr) | |
end | |
STDOUT.flush | |
puts 'after' | |
puts b.client.rate_limit.remaining | |
puts | |
puts 'before2--' | |
puts b.client.rate_limit_remaining | |
prs.each do |pr| | |
puts '=' * 30 + "\n" + "TITLE_PR: #{pr.title}, NR: #{pr.number}\n" + '=' * 30 | |
# this check the last commit state, catch for review or not reviewd status. | |
comm_st = b.client.status(b.repo, pr.head.sha) | |
# pr number trigger. | |
break if b.trigger_by_pr_number(pr) | |
# retrigger if magic word found | |
b.retrigger_check(pr) | |
# check if changelog test was enabled | |
break if b.changelog_active(pr, comm_st) | |
# 0) do test for unreviewed pr | |
break if b.unreviewed_pr_test(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_test(comm_st, pr) | |
end | |
STDOUT.flush | |
puts 'after2--' | |
puts b.client.rate_limit.remaining |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment