class Napkin::CLI::Github

Public Instance Methods

commit_author(repo, commit) click to toggle source
# File lib/napkin/cli/github.rb, line 22
def commit_author(repo, commit)
  author = client.commit(repo, commit)[:author][:login]
  say author
  author
end
teams(org, user) click to toggle source
# File lib/napkin/cli/github.rb, line 11
def teams(org, user)
  teams = client.organization_teams(org).map do |team|
    next if team[:slug].include?('owners') || team[:permission] == 'pull' || !client.team_member?(team[:id], user)
    team[:slug]
  end.compact

  say teams.join(',')
  teams
end

Private Instance Methods

client() click to toggle source
# File lib/napkin/cli/github.rb, line 30
def client
  Octokit::Client.new(
    :access_token => ENV['GITHUB_ACCESS_TOKEN']
  )
end