MCPcopy
hub / github.com/graphql/graphql-spec / graphql

Function graphql

scripts/generate-contributor-list.mjs:121–151  ·  view source on GitHub ↗
(query, variables)

Source from the content-addressed store, hash-verified

119if (!TOKEN) console.error("Warning: no GITHUB_TOKEN/GH_TOKEN (or gh auth token). Resolution will be limited.");
120
121async function graphql(query, variables) {
122 const body = JSON.stringify(variables ? { query, variables } : { query });
123 const options = {
124 hostname: "api.github.com",
125 path: "/graphql",
126 method: "POST",
127 headers: {
128 "User-Agent": "contributors-table-graphql",
129 "Authorization": `Bearer ${TOKEN}`,
130 "Content-Type": "application/json",
131 "Content-Length": Buffer.byteLength(body),
132 },
133 };
134 return await new Promise((resolve) => {
135 const req = https.request(options, (res) => {
136 let data = "";
137 res.setEncoding("utf8");
138 res.on("data", (c) => (data += c));
139 res.on("end", () => {
140 try {
141 const json = JSON.parse(data || "{}");
142 if (json.errors && DEBUG) console.error("GraphQL errors:", JSON.stringify(json.errors, null, 2));
143 resolve(json);
144 } catch { resolve({}); }
145 });
146 });
147 req.on("error", () => resolve({}));
148 req.write(body);
149 req.end();
150 });
151}
152
153// Batch fetch commit author + message for SHAs; count primary-author occurrences per login
154async function fetchCommitsByOidBatch(oids) {

Callers 4

fetchCommitsByOidBatchFunction · 0.85
searchUsersByNameExactFunction · 0.85
searchUsersByLoginTokenFunction · 0.85
fetchProfileNamesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected