MCPcopy Create free account
hub / github.com/TechSpiritSS/Terminal-Portfolio / fetchGithubStats

Function fetchGithubStats

scripts/fetchStats.js:55–79  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53}
54
55async function fetchGithubStats() {
56 try {
57 const githubLink = config.social.find(
58 (c) => c.title.toLowerCase() === "github"
59 ).link;
60 const githubUsername =
61 githubLink.split("/")[githubLink.split("/").length - 1];
62 const responseRaw = await fetch(
63 `https://api.github.com/users/${githubUsername}`
64 );
65 const response = await responseRaw.json();
66 githubStats = { ...response, username: githubUsername };
67 } catch (error) {
68 console.log(error);
69 // handling the error
70 githubStats = {
71 username: githubUsername,
72 bio: "_failed_to_fetch_",
73 public_repos: "_failed_to_fetch_",
74 public_gists: "_failed_to_fetch_",
75 followers: "_failed_to_fetch_",
76 following: "_failed_to_fetch_",
77 };
78 }
79}
80
81export {
82 //functions exported

Callers 1

script.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected