mirror of
https://github.com/LukeHagar/stats-action.git
synced 2025-12-06 04:21:26 +00:00
Apply automatic changes
This commit is contained in:
committed by
github-actions[bot]
parent
35ef185daa
commit
1bf34eaa59
67
dist/index.js
vendored
67
dist/index.js
vendored
@@ -45346,7 +45346,7 @@ const NOT_LANGUAGES_OBJ = Object.fromEntries(NOT_LANGUAGES.map((l) => [l, true])
|
|||||||
try {
|
try {
|
||||||
const token = process.env["GITHUB_TOKEN"];
|
const token = process.env["GITHUB_TOKEN"];
|
||||||
if (!token)
|
if (!token)
|
||||||
throw new Error("GITHUB_TOKEN is not present");
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__.error("GITHUB_TOKEN is not present");
|
||||||
const octokit = new ThrottledOctokit({
|
const octokit = new ThrottledOctokit({
|
||||||
auth: token,
|
auth: token,
|
||||||
throttle: {
|
throttle: {
|
||||||
@@ -45396,16 +45396,13 @@ try {
|
|||||||
const repoContribStatsResp = await getReposContributorsStats(octokit, repoOwner, repoName);
|
const repoContribStatsResp = await getReposContributorsStats(octokit, repoOwner, repoName);
|
||||||
let stats;
|
let stats;
|
||||||
if (!Array.isArray(repoContribStatsResp.data)) {
|
if (!Array.isArray(repoContribStatsResp.data)) {
|
||||||
console.log("RepoContribStats is not an array");
|
|
||||||
console.log(repoContribStatsResp);
|
console.log(repoContribStatsResp);
|
||||||
stats = [repoContribStatsResp.data];
|
stats = [repoContribStatsResp.data];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
stats = repoContribStatsResp.data;
|
stats = repoContribStatsResp.data;
|
||||||
}
|
}
|
||||||
// console.log(stats);
|
|
||||||
const repoContribStats = stats.find((contributor) => contributor.author?.login === username);
|
const repoContribStats = stats.find((contributor) => contributor.author?.login === username);
|
||||||
// console.log(repoContribStats?.weeks);
|
|
||||||
if (repoContribStats?.weeks)
|
if (repoContribStats?.weeks)
|
||||||
contributorStats.push(...repoContribStats.weeks);
|
contributorStats.push(...repoContribStats.weeks);
|
||||||
if (repoOwner === username) {
|
if (repoOwner === username) {
|
||||||
@@ -45465,35 +45462,28 @@ try {
|
|||||||
.map((w) => w.contributionDays)
|
.map((w) => w.contributionDays)
|
||||||
.flat(1);
|
.flat(1);
|
||||||
const tableData = [
|
const tableData = [
|
||||||
{ name: "Name", value: userDetails.data.name || "" },
|
["Name", userDetails.data.name || ""],
|
||||||
{ name: "Username", value: username },
|
["Username", username],
|
||||||
{ name: "Repository Views", value: repoViews },
|
["Repository Views", repoViews],
|
||||||
{ name: "Lines of Code Changed", value: linesOfCodeChanged },
|
["Lines of Code Changed", linesOfCodeChanged],
|
||||||
{ name: "Total Commits", value: totalCommits.data.total_count },
|
["Total Commits", totalCommits.data.total_count],
|
||||||
{
|
["Total Pull Requests", userData.user.pullRequests.totalCount],
|
||||||
name: "Total Pull Requests",
|
["Code Byte Total", codeByteTotal],
|
||||||
value: userData.user.pullRequests.totalCount,
|
["Top Languages", topLanguages.map((lang) => lang.languageName).join(", ")],
|
||||||
},
|
["Fork Count", forkCount],
|
||||||
{ name: "Code Byte Total", value: codeByteTotal },
|
["Star Count", starCount],
|
||||||
{
|
[
|
||||||
name: "Top Languages",
|
"Total Contributions",
|
||||||
value: topLanguages.map((lang) => lang.languageName).join(", "),
|
contributionsCollection.contributionCalendar.totalContributions,
|
||||||
},
|
],
|
||||||
{ name: "Fork Count", value: forkCount },
|
["Closed Issues", userData.viewer.closedIssues.totalCount],
|
||||||
{ name: "Star Count", value: starCount },
|
["Open Issues", userData.viewer.openIssues.totalCount],
|
||||||
{
|
["Fetched At", fetchedAt],
|
||||||
name: "Total Contributions",
|
|
||||||
value: contributionsCollection.contributionCalendar.totalContributions,
|
|
||||||
},
|
|
||||||
{ name: "Closed Issues", value: userData.viewer.closedIssues.totalCount },
|
|
||||||
{ name: "Open Issues", value: userData.viewer.openIssues.totalCount },
|
|
||||||
{ name: "Fetched At", value: fetchedAt },
|
|
||||||
];
|
];
|
||||||
console.table(tableData);
|
const formattedTableData = tableData.map((row) => {
|
||||||
const tableDataString = tableData
|
return { Name: row[0], Value: row[1] };
|
||||||
.map((row) => `${row.name}: ${row.value}`)
|
});
|
||||||
.join("\n");
|
console.table(formattedTableData);
|
||||||
_actions_core__WEBPACK_IMPORTED_MODULE_0__.setOutput("tableData", tableDataString);
|
|
||||||
(0,fs__WEBPACK_IMPORTED_MODULE_2__.writeFileSync)("github-user-stats.json", JSON.stringify({
|
(0,fs__WEBPACK_IMPORTED_MODULE_2__.writeFileSync)("github-user-stats.json", JSON.stringify({
|
||||||
name: userDetails.data.name || "",
|
name: userDetails.data.name || "",
|
||||||
username,
|
username,
|
||||||
@@ -45511,6 +45501,19 @@ try {
|
|||||||
fetchedAt,
|
fetchedAt,
|
||||||
contributionData: allDays,
|
contributionData: allDays,
|
||||||
}, null, 4));
|
}, null, 4));
|
||||||
|
// const tableDataString = tableData
|
||||||
|
// .map((row) => `${row.name}: ${row.value}`)
|
||||||
|
// .join("\n");
|
||||||
|
// core.setOutput("tableData", tableDataString);
|
||||||
|
await _actions_core__WEBPACK_IMPORTED_MODULE_0__.summary.addHeading("Test Results")
|
||||||
|
.addTable([
|
||||||
|
[
|
||||||
|
{ data: "Name", header: true },
|
||||||
|
{ data: "Value", header: true },
|
||||||
|
],
|
||||||
|
...tableData,
|
||||||
|
])
|
||||||
|
.write();
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
_actions_core__WEBPACK_IMPORTED_MODULE_0__.setFailed(error);
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__.setFailed(error);
|
||||||
|
|||||||
15286
github-user-stats.json
15286
github-user-stats.json
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user