fix(ci): resolve fork PRs when recording the preview deployment - #654
Conversation
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers. |
|
gittensory · advisory review Reviewed 1 changed file(s) — two independent AI reviewers. Suggested action: ✅ Safe to merge — both reviewers found no blocking issues. Reviewer A · Suggestions
Worth double-checking
Reviewer B · Suggestions
Worth double-checking
|
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
The "Record deployment for Reviewbot" step resolved the PR via the commit→PR association API, with workflow_run.pull_requests as a fallback. BOTH are empty for fork PRs (the common case here — most open PRs originate from forks), so the step hit "Could not resolve an open PR for <sha>" and never recorded a Deployment — even though the preview itself deployed fine. With no Deployment/environment_url, Reviewbot's "after" screenshot stayed stuck on "Rendering preview…". Add a fork-safe fallback: scan open PRs for the one whose head.sha equals this build's GitHub-set head_sha (the base repo tracks the fork head as refs/pull/N/head, so head.sha is trustworthy even for forks). Add pull-requests:read for the pulls.list call. This is the second half of the preview fix; the first (allowing the served .zip asset through artifact validation) landed in the prior PR.
8781003 to
006ecbb
Compare
Why
Second half of the stuck-preview fix. After #653 (allow
.zip), the preview deploy now runs all the way to a live URL — verified on a re-run of PR #635's build:The "Record deployment for Reviewbot" step resolves the PR via
listPullRequestsAssociatedWithCommit, withworkflow_run.pull_requestsas a fallback. Both are empty for fork PRs — and most open gittensory PRs originate from forks (635, 651, 650, 649, 637, 634 are all cross-repo). So the step fails and no Deployment /environment_urlis ever recorded, leaving Reviewbot's after cell stuck on "Rendering preview…" even though the preview deployed fine.What
Add a fork-safe resolution fallback: scan open PRs for the one whose
head.shaequals this build's GitHub-sethead_sha. The base repo tracks the fork head asrefs/pull/N/head, sohead.shais trustworthy even for forks (confirmed:pulls.listreturnshead.sha = d60b5cc9for fork PR #635). Also addspull-requests: readfor thepulls.listcall.Resolution order now:
workflow_run.pull_requests→ commit association → open-PR head-SHA match (fork-safe).Verification
Will re-run a fresh build→deploy for #635 after merge and confirm a
preview/pr-635Deployment with anenvironment_urlis recorded (which then re-triggers Reviewbot to fill in the "after" screenshot).