MCPcopy Index your code
hub / github.com/PatrickJS/awesome-cursorrules / fetchGitHubUser

Function fetchGitHubUser

scripts/check-pr-author.mjs:100–119  ·  view source on GitHub ↗
(username)

Source from the content-addressed store, hash-verified

98}
99
100async function fetchGitHubUser(username) {
101 const headers = {
102 Accept: "application/vnd.github+json",
103 "User-Agent": "awesome-cursorrules-pr-author-check",
104 };
105 const token = process.env.GITHUB_TOKEN ?? process.env.GH_TOKEN;
106 if (token) {
107 headers.Authorization = `Bearer ${token}`;
108 }
109
110 const response = await fetch(`https://api.github.com/users/${encodeURIComponent(username)}`, {
111 headers,
112 });
113
114 if (!response.ok) {
115 throw new Error(`Unable to fetch GitHub user ${username}: HTTP ${response.status}.`);
116 }
117
118 return response.json();
119}
120
121function parseMinimumAge(value) {
122 const days = Number.parseInt(value, 10);

Callers 1

resolveUserFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected