Skip to content

Commit 5294f61

Browse files
authored
Add audit log graphql at the enterprise level
1 parent b6d15a8 commit 5294f61

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Make sure that you set the request to `POST` with URL `https://api.github.com/graphql`
2+
# Set `Headers` where `Content-Type` is `application/json` and `Accept` is `application/vnd.github.audit-log-preview+json`
3+
4+
{
5+
enterprise(slug: "<enterprise-slug>") {
6+
organizations(first: 100){
7+
nodes {
8+
auditLog(last: 5) {
9+
edges {
10+
node {
11+
... on AuditEntry {
12+
# Get Audit Log Entry by 'Action'
13+
action
14+
actorLogin
15+
createdAt
16+
# User 'Action' was performed on
17+
user{
18+
name
19+
email
20+
}
21+
}
22+
}
23+
}
24+
}
25+
}
26+
}
27+
}
28+
}
29+
30+
# If you'd like to use environment variables, this is what it would look like:
31+
32+
query getAuditLog($slug: String!, $numEntries: Int!, $cursor: String){
33+
enterprise(slug: $slug) {
34+
organizations(first: 100){
35+
nodes {
36+
auditLog(last: $numEntries, before: $cursor) {
37+
edges {
38+
node {
39+
... on AuditEntry { # Get Audit Log Entry by 'Action'
40+
action
41+
actorLogin
42+
createdAt
43+
user { # User 'Action' was performed on
44+
name
45+
email
46+
}
47+
}
48+
}
49+
cursor
50+
}
51+
pageInfo {
52+
endCursor
53+
hasNextPage
54+
}
55+
totalCount
56+
}
57+
}
58+
}
59+
}
60+
}
61+
62+
# Envrionment variables:
63+
{
64+
"slug": "<enterprise-slug>",
65+
"numEntries": 5,
66+
"cursor": null
67+
}

0 commit comments

Comments
 (0)