(email)
| 10 | |
| 11 | const usernameCache = {} |
| 12 | async function resolveUsername(email) { |
| 13 | if (!ghToken || !email) return null |
| 14 | if (usernameCache[email] !== undefined) return usernameCache[email] |
| 15 | |
| 16 | try { |
| 17 | const res = await fetch(`https://api.github.com/search/users?q=${email}`, { |
| 18 | headers: { Authorization: `token ${ghToken}` }, |
| 19 | }) |
| 20 | const data = await res.json() |
| 21 | const login = data?.items?.[0]?.login || null |
| 22 | usernameCache[email] = login |
| 23 | return login |
| 24 | } catch { |
| 25 | usernameCache[email] = null |
| 26 | return null |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | const prAuthorCache = {} |
| 31 | async function resolveAuthorForPR(prNumber) { |
no test coverage detected