Skip to content

Instantly share code, notes, and snippets.

@masutaka
Forked from tmd45/Gemfile
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masutaka/5b965596f82d6788a71d to your computer and use it in GitHub Desktop.
Save masutaka/5b965596f82d6788a71d to your computer and use it in GitHub Desktop.
source 'https://rubygems.org'
ruby '2.1.0'
gem 'i18n'
gem 'activesupport'
gem 'octokit'
require 'yaml'
require 'rubygems'
require 'octokit'
config = YAML.load_file('nippo.yml')
account = config['account']
client = Octokit::Client.new(login: account['id'], access_token: account['access_token'])
events = client.user_events(account['id'])
url_to_detail = {}
events.each do |_|
break unless _.created_at.getlocal.to_date == Time.now.to_date
case _.type
when "IssuesEvent"
url_to_detail[_.payload.issue.html_url] ||= {title: _.payload.issue.title, comments: []}
when "IssueCommentEvent"
url_to_detail[_.payload.issue.html_url] ||= {title: _.payload.issue.title, comments: []}
url_to_detail[_.payload.issue.html_url][:comments] << _.payload.comment.body.split.join(' ')
when "PullRequestEvent"
url_to_detail[_.payload.pull_request.html_url] ||= {title: _.payload.pull_request.title, comments: []}
end
end
url_to_detail.each do |url, detail|
puts "- [#{detail[:title].gsub('`', '\\\`')}](#{url})"
detail[:comments].reverse.each do |comment|
puts "\t* #{comment}"
end
end
account:
id: userid
access_token: accesstoken
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment