mirror of
https://github.com/LukeHagar/stats-action.git
synced 2025-12-06 04:21:26 +00:00
adjusted collection method
This commit is contained in:
@@ -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
|
||||
}
|
||||
48
src/index.ts
48
src/index.ts
@@ -43,16 +43,18 @@ 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) {
|
||||
`query repoInfo($login: String!, $cursor: String) {
|
||||
user(login: $login) {
|
||||
repositories(
|
||||
orderBy: {field: STARGAZERS, direction: DESC}
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user