shiftkey / up-for-grabs-api-demo

A proof-of-concept for caching and munging data from the GitHub API for use against up-for-grabs.net
6 stars 1 forks source link

Project Statistics endpoint #5

Open johncmckim opened 8 years ago

johncmckim commented 8 years ago

An endpoint is needed to provide feedback on community contributions for a repository, see up-for-grabs.net #285.

The two initial statistics should be:

johncmckim commented 8 years ago

I'm not sure how feasible this may be as an api client requires push access to list the collaborators. I didn't see it mentioned in the api docs but I am getting error messages saying 'Must have push access to view repository collaborators.'.

johncmckim commented 8 years ago

An alternative may be to look at contributions not by the owner or organisation members - api endpoint.

This may be skewed in some cases i.e. the up-for-grabs organisation has one public member, but clearly @shiftkey is a major contributor.

However, I still think it's a viable option for one stat at least.

The different between regular frequent community contributors and new / once-off contributors probably needs to be considered. The up-for-grabs tag is targeting new contributors so stats new contributors on this might actually be more useful in exposing how well a project is doing in engaging community contributions.

shiftkey commented 8 years ago

I think you want to have a look at the statistics endpoint, as that's public data (and not based on repository permissions):

https://developer.github.com/v3/repos/statistics/

johncmckim commented 8 years ago

@shiftkey I've looked at that. The only thing I thought is that it didn't link contributions to an up-for-grabs tag i.e. you can't really say the tag helped contributions.

Maybe I'm over thinking this a bit. I guess I really should be asking what kind of stats you are hoping to expose and how they could be used?

Perhaps a simple count of closed & open up-for-grabs issues plus the other contributes from the statistics is enough?

shiftkey commented 8 years ago

@johncmckim apologies for the delay in getting back to this:

Maybe I'm over thinking this a bit. I guess I really should be asking what kind of stats you are hoping to expose and how they could be used?

Yeah, and I probably am too. Let's come back to something simple:

How many issues are open which are up-for-grabs against a repository?

I think this is easy enough to look at using GET /repos/:owner/:repo/issues?labels=:label

How many people contribute to this repository?

Let's not look into the PRs associated with up-for-grabs issues just now - because it assumes that people will label PRs or that we scan the issue comments for something linking it to a PR - and simply compute the number of contributors with GET /repos/:owner/:repo/stats/contributors

:cool:?

johncmckim commented 8 years ago

Sounds good to me. Simple and does the job. Did you want me to contribute a pull request?

shiftkey commented 8 years ago

@johncmckim up to you - this has kinda fallen down my list of priorities, but if you'd like to keep things moving I'm happy to help out with reviewing and deploying it up so we can keep experimenting...

johncmckim commented 8 years ago

@shiftkey I think I can find some time to do a few things on this. Would it be possible to merge in #1 so that I can build off that?

shiftkey commented 8 years ago

@johncmckim then I shall review #1 and try to remember what was left to do!

johncmckim commented 8 years ago

@shiftkey I've done some work on this today. I based the work off what you had done in the warm-cache-up branch. See https://github.com/johncmckim/up-for-grabs-api-demo/tree/stats.

I've separated some of the code out of index.js into different components to make it easier to understand. I've added the ability to count various different endpoints for each repo and support counting above the per_page limit.

It works well for getting open & closed counts for the label. However due to an issue with the contributors api we can only get a max of 100 contributors back.

I can send a pull request. However, I wasn't sure if I should send on with the master or warm-cache-up branch as the base?

shiftkey commented 8 years ago

@johncmckim I've merged #1 now. Feel free to build upon it and I'll look at your stats branch :soon: