(token: string)
| 24 | */ |
| 25 | export async function ghFetch(path: string, token: string, options?: RequestInit) { |
| 26 | try { |
| 27 | const res = await fetch(`https://api.github.com${path}`, { |
| 28 | ...options, |
| 29 | headers: { |
| 30 | Authorization: `token ${token}`, |
| 31 | Accept: 'application/vnd.github.v3+json', |
| 32 | 'X-GitHub-Api-Version': API_VERSION, |
| 33 | ...(options?.headers || {}), |
| 34 | }, |