Skip to content

Instantly share code, notes, and snippets.

@mmcdaris
Created July 8, 2014 01:23
Show Gist options
  • Save mmcdaris/1a2421b5dad5fddd5c0b to your computer and use it in GitHub Desktop.
Save mmcdaris/1a2421b5dad5fddd5c0b to your computer and use it in GitHub Desktop.
get your issues on!
require 'octokit'
class Github
attr_accessor :cli, :user, :gh_user
def initialize(user)
@gh_user = user
@cli = Octokit::Client.new(access_token: ENV["GH_KEY"])
@user = @cli.user
@user.login
end
# where repo is something like 'airbrake/airbrake'
def issues(repo, label, acct=@gh_user)
issues = @cli.issues "#{acct}/#{repo}", per_page: 100
with_labels = issues.select {|i| i.labels.present? }
with_labels.select {|i| i.labels.map{|l| l[:name]}.include?(label) }
end
end
@mmcdaris
Copy link
Author

mmcdaris commented Jul 8, 2014

use with something like:

Github.new("mmcdaris")
# where mmcdaris is your github username
# snippet assumes that you have an env var exported named GH_KEY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment