aardvark
aardvark

Reputation: 83

Github API: How to get list of users who have starred a repo AND cloned it

I'd like to get a list of users who have starred my public repo and a number of fields related to them such as whether or not they have cloned it. Is this possible with the Github API?

Upvotes: 7

Views: 3853

Answers (3)

suhailvs
suhailvs

Reputation: 21740

The endpoint for stargazers is:

https://api.github.com/repos/:owner/:repo/stargazers

for eg, if you want to get users who starred the repo https://github.com/suhailvs/django-schools/ you can use:

https://api.github.com/repos/suhailvs/django-schools/stargazers

Upvotes: 11

kghamilton
kghamilton

Reputation: 23

Github webhook services are fairly detailed and you can really get a lot of information from them but gleaning if someone cloned your repo is a bridge too far. As far as I'm aware, there's no way to track that (you can track new forks). I'd recommend using a webhook to track new repo watches to accomplish at least some of what you're looking for.

Axibase has a tool which leverages Github webhooks, and notifies you via email or instant message (through the messenger of your choice) when someone stars your repository.

The underlying process is here:

enter image description here

It's a quick setup, the whole process takes less then 10 minutes. Basically you need to create a plaintext file with your email / messenger credentials on your local machine, launch an ATSD sandbox from the terminal, and paste the webhook generated at runtime into the appropriate field on Github. The full process is here.

Disclaimer: I work for Axibase

Upvotes: 0

Aurel Bílý
Aurel Bílý

Reputation: 7981

The endpoint for stargazers (users who have starred a repo) is documented here in the documentation. You can follow with additional requests on those users.

Checking whether people have cloned a repo is impossible (you don't even need to be logged in to clone a git / GH repo). You can, however, list the forks of a repo.

Upvotes: 6

Related Questions