MCPcopy Create free account
hub / github.com/EvoMap/evolver / createGithubIssue

Function createGithubIssue

src/gep/issueReporter.js:279–301  ·  view source on GitHub ↗
(repo, title, body, token)

Source from the content-addressed store, hash-verified

277}
278
279async function createGithubIssue(repo, title, body, token) {
280 const url = 'https://api.github.com/repos/' + repo + '/issues';
281 const response = await fetch(url, {
282 method: 'POST',
283 headers: {
284 'Authorization': 'Bearer ' + token,
285 'Accept': 'application/vnd.github+json',
286 'Content-Type': 'application/json',
287 'X-GitHub-Api-Version': '2022-11-28',
288 },
289 body: JSON.stringify({ title: title, body: body }),
290 signal: AbortSignal.timeout(15000),
291 });
292
293 if (!response.ok) {
294 let errText = '';
295 try { errText = await response.text(); } catch (_) {}
296 throw new Error('GitHub API ' + response.status + ': ' + errText.slice(0, 200));
297 }
298
299 const data = await response.json();
300 return { number: data.number, url: data.html_url };
301}
302
303function escapeSearchQuery(s) {
304 return String(s || '').replace(/"/g, '').replace(/[\r\n]+/g, ' ').trim();

Callers 1

maybeReportIssueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected