Skip to content

Instantly share code, notes, and snippets.

@dogeared
Last active December 15, 2015 02:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dogeared/5190834 to your computer and use it in GitHub Desktop.
Save dogeared/5190834 to your computer and use it in GitHub Desktop.
Show who's assigned to which pull NOTE: you may have to install the json gem if you don't already have it. sudo gem install json
#! /usr/bin/ruby
#
require 'rubygems'
require 'json'
require 'open-uri'
user = 'YOUR GITHUB USERNAME'
pass = 'YOUR GITHUB PASSWORD'
repo = 'workmarket/application'
results = {}
unassigned = []
pulls = JSON.parse(open("https://api.github.com/repos/#{repo}/pulls", :http_basic_authentication => [user, pass]).read)
pulls.each do |pull|
issue = JSON.parse(open("https://api.github.com/repos/#{repo}/issues/#{pull['number']}", :http_basic_authentication => [user, pass]).read)
detail = "##{pull['number']} (created: #{pull['created_at']}, updated: #{pull['updated_at']}) - ('#{pull['title']}')"
if issue['assignee'].nil?
unassigned << detail
else
(results["#{issue['assignee']['login']}"] ||= []) << detail
end
end
puts 'unassigned'
unassigned.each do |result|
puts "\t#{result}"
end
results.each_key do |key|
puts key
results[key].each do |result|
puts "\t#{result}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment