Skip to content

Instantly share code, notes, and snippets.

@hiendv
Created December 9, 2025 16:15
Show Gist options
  • Select an option

  • Save hiendv/84835198b1acf3ed7db4ad93feb72b8a to your computer and use it in GitHub Desktop.

Select an option

Save hiendv/84835198b1acf3ed7db4ad93feb72b8a to your computer and use it in GitHub Desktop.
const ranges = generateAnnualRangesTillNow(userOAuth.user_created_at);
const body = JSON.stringify({
query: `query personalStats($user_id: ID) {
viewer {
id
login
issues {
totalCount
}
pullRequests {
totalCount
}
pullRequestsMerged: pullRequests(states: MERGED) {
totalCount
}
followers {
totalCount
}
following {
totalCount
}
repositories(
isFork: true
orderBy: {field: STARGAZERS, direction: DESC}
first: 100
) {
nodes {
nameWithOwner
owner {
__typename
login
}
stargazerCount
defaultBranchRef {
target {
... on Commit {
history {
totalCount
}
mine: history(author: {id: $user_id}) {
totalCount
}
}
}
}
languages(first: 100, orderBy: {field: SIZE, direction: DESC}) {
edges {
size
node {
name
}
}
}
}
}
}
contributions: viewer {
${ranges
.map((range, i) => {
return `_${i}: contributionsCollection(from: "${range[0]}", to: "${range[1]}") {
startedAt
endedAt
commitContributionsByRepository(maxRepositories: 100) {
repository {
nameWithOwner
owner {
__typename
login
}
stargazerCount
defaultBranchRef {
target {
... on Commit {
history {
totalCount
}
}
}
}
languages(first: 100, orderBy: {field: SIZE, direction: DESC}) {
edges {
size
node {
name
}
}
}
}
contributions {
totalCount
}
}
}`;
})
.join("\n")}
}
}`,
variables: `{"user_id": "${profileMetadataParsed.user_id}"}`,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment