Created
December 20, 2017 20:59
-
-
Save sskylar/e3227725119b862082fdc08e4b38c096 to your computer and use it in GitHub Desktop.
Count commits to all repos in GitHub over the past year
This file contains 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' | |
access_token = '<your token here>' | |
whitelist_owners = %w(dropmark siteleaf oakstudios) | |
Octokit.auto_paginate = true | |
client = Octokit::Client.new access_token: access_token | |
total = client.repos.map do |repo| | |
if !repo.fork && whitelist_owners.include?(repo.owner.login) | |
count = client.commit_activity_stats(repo.full_name, {retry_timeout: 60, retry_wait: 1}).map(&:total).reduce(:+) | |
puts "#{repo.full_name},#{count}" | |
count | |
else | |
0 | |
end | |
end.reduce(:+) | |
puts "Total: #{total}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment