Skip to content

Instantly share code, notes, and snippets.

@coulof
Created October 14, 2022 08:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Get non Dell (?) interested github users
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