-
-
Save masutaka/5b965596f82d6788a71d to your computer and use it in GitHub Desktop.
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
source 'https://rubygems.org' | |
ruby '2.1.0' | |
gem 'i18n' | |
gem 'activesupport' | |
gem 'octokit' |
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 '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 |
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
account: | |
id: userid | |
access_token: accesstoken |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment