Created
          May 11, 2012 16:40 
        
      - 
      
- 
        Save vindia/2660848 to your computer and use it in GitHub Desktop. 
    Fetch username of person assigned to GitHub pull request
  
        
  
    
      This file contains hidden or 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 'open-uri' | |
| user = 'GITHUB_USERNAME' | |
| pass = 'GITHUB_PASSWORD' | |
| repo = 'user/repo' | |
| 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) | |
| if issue['assignee'].nil? | |
| message = "is not assigned to anyone yet" | |
| else | |
| message = "is assigned to #{issue['assignee']['login']}" | |
| end | |
| puts "##{pull['number']} ('#{pull['title']}') #{message}" | |
| end | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment