adjusted collection method

This commit is contained in:
luke-hagar-sp
2024-02-29 17:38:35 -05:00
parent d2e47ce10e
commit cd6002a9f4
2 changed files with 78 additions and 36 deletions

View File

@@ -2,10 +2,10 @@
"name": "Luke Hagar",
"username": "lukehagar",
"repoViews": 1589,
"linesOfCodeChanged": 7397302,
"linesOfCodeChanged": 10613251,
"totalCommits": 1582,
"totalPullRequests": 48,
"codeByteTotal": 11731473,
"codeByteTotal": 11731760,
"topLanguages": [
{
"languageName": "Svelte",
@@ -20,7 +20,7 @@
{
"languageName": "TypeScript",
"color": "#3178c6",
"value": 3157579
"value": 3157866
},
{
"languageName": "Makefile",
@@ -82,5 +82,5 @@
"starCount": 113,
"closedIssues": 12,
"openIssues": 10,
"fetchedAt": 1709244633038
"fetchedAt": 1709246251263
}

View File

@@ -43,7 +43,10 @@ export async function getUserData(
);
}
export async function getRepoData(octokit: Octokit, username: string) {
export async function getRepoData(
octokit: Octokit,
username: string
): Promise<GraphQlQueryResponseData> {
return octokit.graphql.paginate(
`query repoInfo($login: String!, $cursor: String) {
user(login: $login) {
@@ -52,7 +55,6 @@ export async function getRepoData(octokit: Octokit, username: string) {
ownerAffiliations: OWNER
isFork: false
first: 100
after: $cursor
) {
totalCount
nodes {
@@ -76,6 +78,34 @@ export async function getRepoData(octokit: Octokit, username: string) {
hasNextPage
}
}
repositoriesContributedTo(
first: 100
includeUserRepositories: false
orderBy: {field: STARGAZERS, direction: DESC}
contributionTypes: [COMMIT, PULL_REQUEST, REPOSITORY, PULL_REQUEST_REVIEW]
after: $cursor
) {
pageInfo {
hasNextPage
endCursor
}
nodes {
nameWithOwner
stargazers {
totalCount
}
forkCount
languages(first: 10, orderBy: {field: SIZE, direction: DESC}) {
edges {
size
node {
name
color
}
}
}
}
}
}
}`,
{
@@ -319,6 +349,8 @@ try {
// getContributionCollection(octokit, accountCreationDate),
]);
console.log("repoData", repoData.user.repositoriesContributedTo.nodes);
let starCount = 0;
let forkCount = 0;
for (const repo of repoData.user.repositories.nodes) {
@@ -329,11 +361,21 @@ try {
const contributorStatsPromises = [];
const viewCountPromises = [];
for (const repo of repoData.user.repositories.nodes) {
if (repo.name) {
contributorStatsPromises.push(
getReposContributorsStats(octokit, username, repo.name)
);
viewCountPromises.push(getReposViewCount(octokit, username, repo.name));
}
}
for (const repo of repoData.user.repositoriesContributedTo.nodes) {
if (repo.name) {
contributorStatsPromises.push(
getReposContributorsStats(octokit, username, repo.name)
);
}
}
const contributorStats = (await Promise.all(contributorStatsPromises))
.filter((entry) => entry !== null || entry !== undefined)