Get non Dell (?) interested github users
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
require 'json' | |
require 'pry' if ENV['INTERACTIVE'] | |
gh = 'gh api -H "Accept: application/vnd.github+json"' | |
#repos = %w(dell/csm dell/csi-powermax dell/csi-unity dell/csi-powerflex dell/csi-powerstore dell/csi-powerscale) | |
repos = JSON.parse(%x[#{gh} /users/dell/repos]).select {|r| r['full_name'] =~ /csm|csi-|karavi|ansible/} | |
subscribers = [] | |
contributors = [] | |
stargazers = [] | |
repos.each do |r| | |
p r['full_name'] | |
subscribers << JSON.parse(%x[#{gh} /repos/#{r['full_name']}/subscribers]) | |
#ap JSON.parse(%x[gh api -H "Accept: application/vnd.github+json" /repos/#{r}/subscribers]) | |
contributors << JSON.parse(%x[#{gh} /repos/#{r['full_name']}/contributors]) | |
stargazers << JSON.parse(%x[#{gh} /repos/#{r['full_name']}/stargazers]) | |
end | |
#gh api -H "Accept: application/vnd.github+json" /users/nitesh3108 | |
subscribers.flatten!.uniq! | |
contributors.flatten!.uniq! | |
stargazers.flatten!.uniq! | |
possible_customers = subscribers.map { |s| s['login'] } - contributors.map { |c| c["login"] } | |
possible_customers << stargazers.map { |s| s['login'] } - contributors.map { |c| c["login"] } | |
possible_customers.flatten!.uniq! | |
binding.pry if ENV['INTERACTIVE'] | |
possible_customers.each do |l| | |
x = JSON.parse(%x[#{gh} /users/#{l}]) | |
puts "#{x['login']} --- #{x['email'] unless x['email'].nil?}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment