Created
February 16, 2016 12:12
-
-
Save morkeleb/57670226064f0a7492f4 to your computer and use it in GitHub Desktop.
Latest change date for an organisations repositories
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 "github_api" | |
user = 'username' | |
token = 'oauth access token obtained from user settings' | |
organisation = 'myorg' | |
Github.configure do |c| | |
c.basic_auth = "#{user}:#{token}" | |
c.oauth_token = token | |
end | |
class Commit | |
attr_accessor :repo, :date, :message | |
end | |
github = Github.new | |
repos = github.repos.list org: organisation | |
list = repos.auto_paginate(true).map { |repo| | |
c = Commit.new | |
c.repo = repo.name | |
c.date = "1990-10-10" | |
begin | |
r = github.repos.commits.list organisation, repo.name | |
commit = r.first.commit | |
c.date = commit.author.date | |
c.message = commit.message | |
rescue | |
end | |
c | |
}.sort_by {|x| x.date} | |
list.each { |c| | |
p "#{c.date} - #{c.repo} : #{c.message}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment