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",
|
"name": "Luke Hagar",
|
||||||
"username": "lukehagar",
|
"username": "lukehagar",
|
||||||
"repoViews": 1589,
|
"repoViews": 1589,
|
||||||
"linesOfCodeChanged": 7397302,
|
"linesOfCodeChanged": 10613251,
|
||||||
"totalCommits": 1582,
|
"totalCommits": 1582,
|
||||||
"totalPullRequests": 48,
|
"totalPullRequests": 48,
|
||||||
"codeByteTotal": 11731473,
|
"codeByteTotal": 11731760,
|
||||||
"topLanguages": [
|
"topLanguages": [
|
||||||
{
|
{
|
||||||
"languageName": "Svelte",
|
"languageName": "Svelte",
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
{
|
{
|
||||||
"languageName": "TypeScript",
|
"languageName": "TypeScript",
|
||||||
"color": "#3178c6",
|
"color": "#3178c6",
|
||||||
"value": 3157579
|
"value": 3157866
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"languageName": "Makefile",
|
"languageName": "Makefile",
|
||||||
@@ -82,5 +82,5 @@
|
|||||||
"starCount": 113,
|
"starCount": 113,
|
||||||
"closedIssues": 12,
|
"closedIssues": 12,
|
||||||
"openIssues": 10,
|
"openIssues": 10,
|
||||||
"fetchedAt": 1709244633038
|
"fetchedAt": 1709246251263
|
||||||
}
|
}
|
||||||
106
src/index.ts
106
src/index.ts
@@ -43,41 +43,71 @@ 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(
|
return octokit.graphql.paginate(
|
||||||
`query repoInfo ($login: String!, $cursor: String) {
|
`query repoInfo($login: String!, $cursor: String) {
|
||||||
user(login: $login) {
|
user(login: $login) {
|
||||||
repositories(
|
repositories(
|
||||||
orderBy: {field: STARGAZERS, direction: DESC}
|
orderBy: {field: STARGAZERS, direction: DESC}
|
||||||
ownerAffiliations: OWNER
|
ownerAffiliations: OWNER
|
||||||
isFork: false
|
isFork: false
|
||||||
first: 100
|
first: 100
|
||||||
after: $cursor
|
) {
|
||||||
) {
|
totalCount
|
||||||
totalCount
|
nodes {
|
||||||
nodes {
|
stargazers {
|
||||||
stargazers {
|
totalCount
|
||||||
totalCount
|
}
|
||||||
|
forkCount
|
||||||
|
name
|
||||||
|
languages(first: 10, orderBy: {field: SIZE, direction: DESC}) {
|
||||||
|
edges {
|
||||||
|
size
|
||||||
|
node {
|
||||||
|
color
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
forkCount
|
pageInfo {
|
||||||
name
|
endCursor
|
||||||
languages(first: 10, orderBy: {field: SIZE, direction: DESC}) {
|
hasNextPage
|
||||||
edges {
|
}
|
||||||
size
|
}
|
||||||
node {
|
repositoriesContributedTo(
|
||||||
color
|
first: 100
|
||||||
name
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pageInfo {
|
|
||||||
endCursor
|
|
||||||
hasNextPage
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}`,
|
||||||
}`,
|
|
||||||
{
|
{
|
||||||
login: username,
|
login: username,
|
||||||
}
|
}
|
||||||
@@ -319,6 +349,8 @@ try {
|
|||||||
// getContributionCollection(octokit, accountCreationDate),
|
// getContributionCollection(octokit, accountCreationDate),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
console.log("repoData", repoData.user.repositoriesContributedTo.nodes);
|
||||||
|
|
||||||
let starCount = 0;
|
let starCount = 0;
|
||||||
let forkCount = 0;
|
let forkCount = 0;
|
||||||
for (const repo of repoData.user.repositories.nodes) {
|
for (const repo of repoData.user.repositories.nodes) {
|
||||||
@@ -329,10 +361,20 @@ try {
|
|||||||
const contributorStatsPromises = [];
|
const contributorStatsPromises = [];
|
||||||
const viewCountPromises = [];
|
const viewCountPromises = [];
|
||||||
for (const repo of repoData.user.repositories.nodes) {
|
for (const repo of repoData.user.repositories.nodes) {
|
||||||
contributorStatsPromises.push(
|
if (repo.name) {
|
||||||
getReposContributorsStats(octokit, username, repo.name)
|
contributorStatsPromises.push(
|
||||||
);
|
getReposContributorsStats(octokit, username, repo.name)
|
||||||
viewCountPromises.push(getReposViewCount(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))
|
const contributorStats = (await Promise.all(contributorStatsPromises))
|
||||||
|
|||||||
Reference in New Issue
Block a user