-
-
Save steakunderscore/828eba7b60551187c9c3 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/env ruby | |
require 'net/ssh' | |
require 'json' | |
users = %w(user) | |
host = localhost | |
Net::SSH.start(host, ENV['USER'] , port: 29418) do |ssh| | |
result = ssh.exec!('gerrit ls-projects --type code --format json') | |
data = JSON.parse(result) | |
projects = data.keys | |
projects.each do |project| | |
puts "For the #{project} project" | |
users.each do |user| | |
result = ssh.exec!("gerrit query --format=JSON -- -owner:#{user} status:open -reviewer:#{user} project:#{project} -is:draft") | |
data = JSON.parse("[#{result.lines.to_a.join(',')}]") | |
count = data[-1]['rowCount'] | |
puts " #{user} has #{count} patchs to review" if count > 0 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment