Fix manual PR-recreation instructions to match actual git transport (bundle vs patch) - #55510
Conversation
|
Hey Since this is still a draft with no code changes yet, a couple of things to watch for as you develop:
Looking forward to the fix — this addresses a real blocker for users applying patches manually.
|
…ansport Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates protected-file fallback issues to generate recovery commands matching bundle or patch transport.
Changes:
- Adds shared bundle/patch recovery-command builders.
- Integrates transport-aware instructions into both PR fallback flows.
- Adds tests for each transport.
Show a summary per file
| File | Description |
|---|---|
actions/setup/md/manifest_protection_push_to_pr_fallback.md |
Uses generated apply instructions. |
actions/setup/md/manifest_protection_push_failed_fallback.md |
Uses generated recovery instructions. |
actions/setup/js/push_to_pull_request_branch.test.cjs |
Tests both transports. |
actions/setup/js/push_to_pull_request_branch.cjs |
Selects instructions from the artifact type. |
actions/setup/js/create_pull_request.test.cjs |
Tests push-failure recovery instructions. |
actions/setup/js/create_pull_request.cjs |
Renders transport-aware recovery commands. |
actions/setup/js/create_pull_request_helpers.cjs |
Adds shared command builders. |
Review details
Suppressed comments (2)
actions/setup/js/create_pull_request_helpers.cjs:385
- This hardcodes
refs/heads/${branchName}, although the existing apply path must resolve a sole alternate branch ref orHEADwhen that ref is absent (push_to_pull_request_branch.cjs:1044-1092), and the repository has an explicit HEAD-only bundle test. A protected-files fallback can occur before that resolution, so users receive another non-functional fetch command for these supported bundles. Generate the samegit bundle list-heads/HEADfallback in the manual instructions and test it with an actual bundle.
`git fetch /tmp/agent-${runId}/${artifactFileName} refs/heads/${branchName}:refs/bundles/manual-apply`,
actions/setup/js/create_pull_request_helpers.cjs:388
- The handler supports updating an explicitly configured fork head and computes its distinct push target (
push_to_pull_request_branch.cjs:735-761), but this helper always tells the user to pushorigin. In a normal checkout,originis the base repository, so the command either fails or updates a same-named base-repo branch instead of the existing fork PR. Pass the resolved head-repository remote/URL into this helper and use it for both fetch and push instructions.
`git push origin ${branchName}`,
- Files reviewed: 7/7 changed files
- Comments generated: 2
- Review effort level: Balanced
|
Please do one focused follow-up pass:
I also attempted a branch refresh for this PR in this run. Run: https://github.com/github/gh-aw/actions/runs/32781466813
|
Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Addressed in 002186c. The manual apply instructions now reset the local branch from |
|
🎉 This pull request is included in a new release. Release: |
Manually-created PR instructions in fallback issues told users to run
git am --3wayagainst a downloaded artifact, but the actual artifact is a git bundle by default (patch-format: bundle), whichgit amcannot apply — causing every manual recovery attempt to fail withpatch does not apply.Root cause
manifest_protection_push_failed_fallback.mdandmanifest_protection_push_to_pr_fallback.md(used when protected files block an automated push or apply) hardcodedgit am --3wayinstructions regardless of transport.Changes
New shared helpers in
create_pull_request_helpers.cjs:buildManualBranchRecoveryCommands— recreates a new local branch and pushes it, used before opening a PR by hand.buildManualBranchApplyCommands— applies changes onto an existing remote branch (e.g. an already-open PR).Both pick bundle-based (
git fetchinto a temp ref →git update-ref/git reset --hard) or patch-based (git am --3way) commands based onhasBundleFile.create_pull_request.cjs: protected-files push-failed fallback now detects the actual artifact type and renders the matching instructions.push_to_pull_request_branch.cjs: protected-files apply fallback does the same for the existing-branch case.Templates: replaced hardcoded patch/
git amcommand blocks with a single{apply_instructions}placeholder filled in by the caller; also genericized "patch" wording to "changes"/"artifact" since it may be a bundle.Example — bundle transport now correctly renders:
instead of the previously-emitted (and non-functional)
git am --3way /tmp/agent-12345/aw-feature.bundle.