4

So after searching through various resources over the internet I have come to a point where I need a third opinion.

The problem statement: I would like to integrate my user's GitHub account activity inside app. I would mainly like to alert my user when events occur under his GitHub account, such as when a repo is created, deleted or pushed to or when a new user is added to a team or on organization.

So far, I am able to retrieve few of this events from the GitHub developer API.

https://developer.github.com/v3/activity/events/

There are two problems with this.

  1. It doesn't include some of the events such as when a repository is deleted.
  2. It doesn't include the event source location/ip address - which is one of the most important thing that I need.

I know that, For enterprise domains github provides "audit-log" functionality which has almost all the information I need to achieve the resolution for my task, However these "audit-logs" are not exposed via the developer API. (Is this correct?)

Related stackoverflow answer

My questions are,

  1. What would be the best approach to get these events with their source location/country (like audit-logs) into my app.

  2. Is there a way to retrieve this audit-logs somehow? Are there any libraries available that may help?

Thanks!

Community
  • 1
  • 1
akif vohra
  • 86
  • 4

1 Answers1

0

If your repository is part of an organization, you could, starting May 23rd 2019 (4 years later), use the Audit Log API

Today we’re introducing the public beta of the Audit Log API.
As a GitHub Enterprise Cloud organization administrator, you can now access log events using our GraphQL API and monitor the activity in your organization.

As explained in "Using the Audit log API", this is only, for now, reserved to organizations using GitHub Enterprise.

See "GraphQL API Audit Log preview", for the exact API.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Important to stress this is only relevant, both on the GraphQL and the REST API, to the Enterprise license.. which is a bit of a shame. – JAR.JAR.beans May 06 '21 at 13:47
  • 1
    @JAR.JAR.beans Indeed. That is what I meant with "this is only, for now, reserved to organizations using GitHub Enterprise." – VonC May 06 '21 at 14:00