Skip to content

Instantly share code, notes, and snippets.

@gabrieljoelc
Last active November 10, 2017 00:21
Show Gist options
  • Save gabrieljoelc/ccc10afca3e1cc1ab572c7a536dab054 to your computer and use it in GitHub Desktop.
Save gabrieljoelc/ccc10afca3e1cc1ab572c7a536dab054 to your computer and use it in GitHub Desktop.
Ruby script to collect "hits" (successes) for developers
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
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