Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to filter GitHub REST API events by type?

Using the REST API, I want to filter events by their type.

For example, we can see all of a users events with: https://api.github.com/users/gaearon/events 1

but I want to limit it to just of a certain type, like PushEvent. https://api.github.com/users/gaearon/events?type=PushEvent

Anyone have any idea if this is even possible?

The end goal is to count a user's daily number of commit for 30 days.

like image 455
Ronnie Avatar asked Nov 08 '22 02:11

Ronnie


1 Answers

You could setup a webhook, which is designed to filter events.

You would then only receive to your listener push events, that you can then filter per author.

But that is for future commits.

For past commits already pushed, you would need a GraphQL request, like for instance Commit stats for commits in repository in order to get all commits and filter by author (check also GraphQL changelog for the latest possibilities)

like image 109
VonC Avatar answered Nov 15 '22 07:11

VonC