Conversation
…flow_run
documentation-deploy.yml resolved the originating PR by falling back to
GET /repos/{owner}/{repo}/commits/{sha}/pulls when workflow_run.pull_requests
was empty, which GitHub leaves empty for every fork PR by design. That
fallback itself doesn't reliably index fork-only commits either (confirmed
empty via both REST and GraphQL for PR #12653's commits), so every fork PR
deploy failed at Resolve PR number.
Have documentation.yml save github.event.pull_request.number as its own
artifact on the pull_request event (a value provided by GitHub, not
influenced by the PR's contents) and have documentation-deploy.yml read it
back instead of trying to look the PR up after the fact.
Fixes #12655
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. WalkthroughThe documentation workflow now uploads the pull request number as an artifact. The deployment workflow downloads and validates that value instead of resolving the pull request through workflow metadata or commit-based GitHub API queries. ChangesDocumentation Preview PR Tracking
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant DocumentationWorkflow
participant ArtifactStorage
participant DocumentationDeploy
DocumentationWorkflow->>ArtifactStorage: Upload pr-number artifact
DocumentationDeploy->>ArtifactStorage: Download pr-number artifact
ArtifactStorage-->>DocumentationDeploy: Return pr_number.txt
DocumentationDeploy->>DocumentationDeploy: Read and validate PR_NUM
Merge Risk: ⚪ Minimal · up to The documentation preview workflow preserves the PR number for both fork and same-repository pull requests, with no actionable merge-blocking risk identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Preview: https://pf-react-pr-12656.surge.sh A11y report: https://pf-react-pr-12656-a11y.surge.sh |
Summary
documentation-deploy.yml'sResolve PR numberstep falls back toGET /repos/{owner}/{repo}/commits/{sha}/pullswheneverworkflow_run.pull_requestsis empty — which GitHub leaves empty for every fork PR by design (only populated when the PR's head branch is in the same repo as the base).associatedPullRequestsfield — both return zero results, even a day after the run, so it isn't a transient indexing delay.Resolve PR number, and the only working path is a manual/deploy-previewcomment.Fix
documentation.ymlnow savesgithub.event.pull_request.numberto a file and uploads it as apr-numberartifact on thepull_requestevent, alongside the existingdocumentationanda11y-coverageartifacts.documentation-deploy.ymldownloads that artifact and reads the PR number from it instead of trying to reverse-engineer it from the API afterward.This value comes from
github.event.pull_request.number, a field GitHub populates from the actual event metadata before the job's shell runs — it isn't influenced by anything in the PR's checked-out code, so it carries the same trust level as thedocumentation/a11y-coverageartifacts already produced by this job.Note: an earlier version of this same split (#12625) used this exact solution, and it was replaced with the current API-lookup approach after a CodeRabbit review flagged the artifact as "untrusted." Having now confirmed the API-lookup path is fundamentally broken for fork PRs (not just under-hardened), and that the artifact's content isn't attacker-influenceable, this PR adds back the original solution. If CodeRabbit flags this again we should ignore it's suggestion.
Closes #12655
🤖 Claude Code assisted in the solution for this issue.
Summary by CodeRabbit