Commit 114c77c
authored
fix(test-classifier): --pr works on closed/merged PRs + repos other than origin (#74)
A user reported '--pr 106' failing with 'could not look up PR #106 … verify the
PR number exists' even though 'gh pr view 106' worked. Two problems:
1. Misdiagnosis in the message. PR STATE is not the issue — gh pr view returns
baseRefName for open/closed/merged alike (verified). The real cause is repo
resolution: #64 pinned the lookup to origin's slug (correct for forks whose
PR is on the fork), but that BREAKS when the PR lives on a different repo than
origin — e.g. the PR is on the upstream/parent, or the user relies on
'gh repo set-default'. The origin-pinned 'gh pr view -R <origin>' then finds
nothing and we wrongly told them the PR doesn't exist.
2. No fallback. Now: try origin first (keeps the fork fix), then fall back to
gh's OWN default resolution (no -R); adopt whichever repo actually resolved so
the later comment-post + metrics row target the right place. AI_REVIEW_REPO
still overrides and short-circuits the fallback.
Also rewrote the error to say plainly it's a repo/access issue (not PR state) and
to point at AI_REVIEW_REPO=owner/name as the fix.
Verified: gh pr view returns baseRefName for a MERGED PR; headRepositoryOwner/
headRepository jq resolves a valid owner/name; bash -n clean. The actual
cross-repo fork+upstream case needs a user with that remote layout to confirm
end-to-end.1 parent be837c4 commit 114c77c
1 file changed
Lines changed: 35 additions & 4 deletions
Lines changed: 35 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
288 | 297 | | |
289 | 298 | | |
290 | | - | |
| 299 | + | |
291 | 300 | | |
292 | | - | |
| 301 | + | |
| 302 | + | |
293 | 303 | | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
294 | 322 | | |
295 | | - | |
296 | | - | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
297 | 328 | | |
298 | 329 | | |
299 | 330 | | |
| |||
0 commit comments