Last active
November 10, 2017 00:21
-
-
Save gabrieljoelc/ccc10afca3e1cc1ab572c7a536dab054 to your computer and use it in GitHub Desktop.
Ruby script to collect "hits" (successes) for developers
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
class Hits | |
attr_reader :client | |
def initialize(github_client) | |
@client = github_client | |
end | |
# Assumptions: | |
# - Using orgs | |
# - Closed dates range is a guess on things completed | |
# Example: | |
# issues('myorg', 'gabrieljoelc', '2017-07-01', '2017-08-09') | |
def issues(org, assignee, closed_start_date, closed_end_date) | |
issues = client.search_issues("org:#{org} assignee:#{assignee} closed:>#{closed_start_date} closed:<#{closed_end_date}").items | |
next_page = client.last_response.rels[:next] | |
while next_page do | |
issues.concat(next_page.get.data.items) | |
next_page = client.last_response.rels[:next] | |
end | |
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
require 'octokit' | |
client = Octokit::Client.new(:access_token => "***") | |
hits = Hits.new(client) | |
issue_titles = hits.issues('gabrieljoelc', 'gabrieljoelc', '2017-07-01', '2017-08-09').map { |issue| issue.title } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment