Skip to content

Instantly share code, notes, and snippets.

@beydogan
Last active December 25, 2015 05:49
Show Gist options
  • Save beydogan/6927650 to your computer and use it in GitHub Desktop.
Save beydogan/6927650 to your computer and use it in GitHub Desktop.
Github API - get all files of commits from user's repos
username = 'beydogan'
user_files = []
user_repos = github.repos.list user: username
user_orgs = github.orgs.list user: username
user_repos.each do |repo|
name = repo.name
owner = repo.owner.login
commits = github.repos.commits.list owner, name, :author => username
commits_list.each do |commit|
commit_details = github.repos.commits.get owner, name, commit.sha
files = commit_details.files
user_files << files
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment