Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get commits from organizations #16

Open
tipsy opened this issue Dec 13, 2017 · 15 comments
Open

Get commits from organizations #16

tipsy opened this issue Dec 13, 2017 · 15 comments

Comments

@tipsy
Copy link
Owner

tipsy commented Dec 13, 2017

ruslan suggests to get all user commits from orgs via listUserOrgs(user).forEach { org -> org.repos.forEach { repo -> repo.statictics } }
this will potentially result in thousands of requests, depending on what kind of orgs user is a member of

maybe request limit can be increased if user auths? maybe there is a better way?

@tipsy
Copy link
Owner Author

tipsy commented Dec 16, 2017

To the people who want this: Would you be okay with authorizing the app to let it make requests with your token? I can't think of any way to do this with my own token that won't instantly trigger the rate-limit.

@tipsy tipsy changed the title get user commits from orgs? Get commits from organizations Dec 16, 2017
@mithlesh4257
Copy link

Shall we not first list user organizations and find commits to each orgs ?
https://developer.github.com/v3/orgs/#list-user-organizations
https://developer.github.com/v3/repos/commits/

This may work.

@tipsy
Copy link
Owner Author

tipsy commented Dec 18, 2017

@mithlesh4257 Writing the code for it isn't really a problem, but let's say I'm a member of google, which has 1148 repos. I picked ten repos at random and got an average of 800 commits (I have no idea if this number is correct, but let's assume it is for now).
The max page size for the API is 100, which gives us 1140/100 * 800/100 = 12 * 80 = 960 requests. These requests come on top of the normal user requests, and only account for 1 organization. I'm already approaching the rate-limit every hour, and several people who work for google, microsoft, and other huge organizations have been using the tool.

I suppose we could run a batch-job for organizations to cache the relevant information. It would mean slightly outdated info, but that's probably okay. It's a bit of work though.

@tipsy
Copy link
Owner Author

tipsy commented Dec 18, 2017

It seems that it's possible to use the event-api to achieve this:

val repoCommits2 = GhService.getUserEvents(username).filter { event -> event.type == Event.TYPE_PUSH }.map {
    it.repo to (it.payload as PushPayload).commits
}.toMap()

@matejkramny
Copy link

Using the App approach to increase API limits is good, better than the stargaze method

@tipsy
Copy link
Owner Author

tipsy commented Jan 1, 2018

The event API is basically useless:

Events support pagination, however the per_page option is unsupported. The fixed page size is 30 items. Fetching up to ten pages is supported, for a total of 300 events - /v3/activity/events

@tedivm
Copy link

tedivm commented Jan 5, 2018

I would definitely be okay with authenticating.

@aduguid
Copy link

aduguid commented Jan 30, 2018

This feature would be awesome!

@ghost
Copy link

ghost commented Apr 26, 2018

any news on this?

@tipsy
Copy link
Owner Author

tipsy commented Apr 26, 2018

@lordadamson no, I've pretty much stopped adding new functionality to this project. If you wanna create a PR I'll merge it though.

@ghost
Copy link

ghost commented Apr 26, 2018 via email

@tipsy
Copy link
Owner Author

tipsy commented Apr 26, 2018

Probably. Traffic is pretty low on the project these days, so I think it would also be okay to try without, then if the number of requests falls under a certain limit require auth.

@dolmen
Copy link

dolmen commented Aug 29, 2018

Use case: I have so many repos that I have created organizations for my own projects per language:

So I would like to be able to see https://profile-summary-for-github.com/user/dolmen-go

@dolmen
Copy link

dolmen commented Aug 29, 2018

Note that Commit per quarter doesn't work for an organization: only zeroes.

@tipsy
Copy link
Owner Author

tipsy commented Aug 29, 2018

I don't have the time to work on this project at the moment, but pull requests are welcome @dolmen !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants