MCPcopy Create free account
hub / github.com/TanStack/router / githubRequest

Function githubRequest

scripts/benchmarks/common/upsert-pr-comment.mjs:56–81  ·  view source on GitHub ↗
({ apiUrl, token, method, endpoint, body })

Source from the content-addressed store, hash-verified

54}
55
56async function githubRequest({ apiUrl, token, method, endpoint, body }) {
57 const url = `${apiUrl.replace(/\/$/, '')}${endpoint}`
58 const response = await fetch(url, {
59 method,
60 headers: {
61 Authorization: `Bearer ${token}`,
62 Accept: 'application/vnd.github+json',
63 'User-Agent': 'tanstack-router-bundle-size-bot',
64 'Content-Type': 'application/json',
65 },
66 body: body ? JSON.stringify(body) : undefined,
67 })
68
69 if (!response.ok) {
70 const text = await response.text()
71 throw new Error(
72 `${method} ${endpoint} failed (${response.status} ${response.statusText}): ${text}`,
73 )
74 }
75
76 if (response.status === 204) {
77 return undefined
78 }
79
80 return response.json()
81}
82
83async function listIssueComments({ apiUrl, token, repo, pr }) {
84 const comments = []

Callers 2

listIssueCommentsFunction · 0.85
mainFunction · 0.85

Calls 4

replaceMethod · 0.65
textMethod · 0.65
jsonMethod · 0.65
fetchFunction · 0.50

Tested by

no test coverage detected