Use explicit PR head baseline for fork PR branch updates#56119
Conversation
Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds an explicit PR-head baseline so incremental safe-output patches and bundles work correctly for fork PRs.
Changes:
- Exports PR checkout baseline metadata.
- Prefers the recorded baseline during patch and bundle generation.
- Adds fork and same-named branch regression tests.
Show a summary per file
| File | Description |
|---|---|
actions/setup/js/checkout_pr_branch.cjs |
Records PR-head baseline metadata. |
actions/setup/js/checkout_pr_branch.test.cjs |
Tests baseline exports. |
actions/setup/js/safe_outputs_handlers.cjs |
Applies baseline to push artifacts. |
actions/setup/js/safe_outputs_handlers.test.cjs |
Tests safe-output persistence. |
actions/setup/js/generate_git_patch.cjs |
Supports explicit incremental patch bases. |
actions/setup/js/generate_git_patch.test.cjs |
Covers fork and name-collision patches. |
actions/setup/js/generate_git_bundle.cjs |
Supports explicit incremental bundle bases. |
actions/setup/js/generate_git_bundle.test.cjs |
Covers fork bundle generation. |
Review details
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 8/8 changed files
- Comments generated: 2
- Review effort level: Balanced
| return; | ||
| } | ||
| core.exportVariable("GH_AW_PR_HEAD_BASE_BRANCH", branchName); | ||
| core.exportVariable("GH_AW_PR_HEAD_BASE_SHA", baseSha); |
There was a problem hiding this comment.
Fixed in cd10... — now resolving HEAD^{commit} after checkout and exporting that as GH_AW_PR_HEAD_BASE_SHA instead of the payload/API head.sha.
| if (!baselineBranch || baselineBranch !== branchName || (!baselineRef && !baselineSha)) { | ||
| return null; | ||
| } |
There was a problem hiding this comment.
Fixed in b997284 — the checkout step now exports GH_AW_PR_HEAD_BASE_PR_NUMBER alongside the baseline, and resolvePRHeadBaselineForPush rejects the recorded baseline unless it matches the effective target PR number (explicit pull_request_number, or the triggering PR/issue context).
|
@copilot PR #56119 is ready for forward progress.
|
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
Category: bug; risk: medium; score: 54/100 (impact 25/50, urgency 16/30, quality 13/20); recommended action: batch_review; CI: pending/unknown; review signal: 3 reviews, 1 issue comment.
|
push_to_pull_request_branchcould not generate incremental patches for fork PRs checked out viarefs/pull/<N>/head, because it expectedorigin/<head.ref>to exist in the base repository. In same-named branch cases, that fallback could also select the wrong base repo ref.Record PR checkout baseline
GH_AW_PR_HEAD_BASE_*for later safe-output patch generation.Use explicit incremental base
origin/<branch>.origin/<branch>path as a same-repo/backward-compatible fallback.Avoid misleading fork guidance
checkout.fetchfor fork branches.Regression coverage
origin/<branch>.