Look up a PR by number using gh CLI
(prNumber: number, repo?: string)
| 230 | |
| 231 | /** Look up a PR by number using gh CLI */ |
| 232 | function lookupPr(prNumber: number, repo?: string): { url: string; author?: string; commitHash?: string } | null { |
| 233 | try { |
| 234 | const ghArgs = ['gh', 'pr', 'view', String(prNumber), '--json', 'url,author,mergeCommit']; |
| 235 | if (repo) ghArgs.push('--repo', repo); |
| 236 | |
| 237 | const result = tryRunArgs(ghArgs); |
| 238 | if (!result) return null; |
| 239 | |
| 240 | const pr = JSON.parse(result); |
| 241 | return { |
| 242 | url: pr.url, |
| 243 | author: pr.author?.login, |
| 244 | commitHash: pr.mergeCommit?.oid, |
| 245 | }; |
| 246 | } catch { |
| 247 | return null; |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * Find the PR that introduced a bump file by checking git log |
no test coverage detected
searching dependent graphs…