These are some handy snippets to get common metrics for checking how active a software engineer is.
- How many pushes are made by the IC?
- How many reviews are made by the IC?
- How many comments are made by the IC?
The API endpoint is https://api.github.com/graphql.
Don't forget to create a Personal Access Token ("classic") and set the correct headers before calling the API.
Header | Value |
---|---|
Content-Type |
application/json |
Accept |
application/vnd.github.v3+json |
Authorization |
Bearer {PAT} |
query ($user: String!, $start: DateTime!, $end: DateTime!) {
user(login: $user) {
contributionsCollection(from: $start, to: $end) {
commitContributionsByRepository(maxRepositories: 100) {
repository {
nameWithOwner
}
contributions {
totalCount
}
}
}
}
rateLimit {
cost
remaining
}
}
{
"user": "YOUR_USER",
"start": "2022-01-01T00:00:00Z",
"end": "2022-12-31T00:00:00Z"
}
Use $.data..totalCount
to get the count for each repository.
query ($query: String!) {
search(last: 100, query: $query, type: ISSUE) {
nodes {
... on PullRequest {
number
title
createdAt
mergedAt
}
}
pageInfo {
hasNextPage
endCursor
}
}
rateLimit {
cost
remaining
}
}
{
"query": "created:2022-01-01..2022-12-31 reviewed-by:YOUR_USER"
}
Use $.data.search.nodes.length
to get the count.
query ($query: String!) {
search(last: 100, query: $query, type: ISSUE) {
nodes {
... on Comment {
createdAt
}
}
pageInfo {
hasNextPage
endCursor
}
}
rateLimit {
cost
remaining
}
}
{
"query": "created:2022-01-01..2022-12-31 commenter:YOUR_USER"
}
Use $.data.search.nodes.length
to get the count.