(ref)
| 183 | |
| 184 | const commitShaCache = new Map(); // ref -> sha |
| 185 | async function getCommitShaForRef(ref) { |
| 186 | if (commitShaCache.has(ref)) return commitShaCache.get(ref); |
| 187 | // Works for branch or tag or SHA itself |
| 188 | // GET /commits/{ref} |
| 189 | const data = await fetchJSON(`https://api.github.com/repos/${OWNER}/${REPO}/commits/${encodeURIComponent(ref)}`); |
| 190 | commitShaCache.set(ref, data.sha); |
| 191 | return data.sha; |
| 192 | } |
| 193 | |
| 194 | async function getRepoTree(ref) { |
| 195 | // Use trees API for a single call listing all files |
no test coverage detected