fix(create-pull-request): push branch before creating fallback issue for protected-files fallback-to-issue#35990
Merged
Conversation
…allback-to-issue When `protected-files: fallback-to-issue` is configured, the bundle and patch (am) transport paths were unconditionally skipping the branch push and setting `manifestProtectionPushFailedError`, which caused the downstream issue body selector to always render the push-failed template (with `gh run download` instructions and no compare URL). Fix: remove the unconditional skip blocks in both transport paths. For the bundle path, add `manifestProtectionFallback` handling in the catch block so genuine push failures still route to the push-failed template. The patch path catch block already handled this correctly. Result: the branch is pushed normally when fallback-to-issue fires, and the fallback issue contains a clickable compare URL so reviewers can inspect the diff in the GitHub UI before promoting the branch to a PR. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix fallback issue without branch link in PR
fix(create-pull-request): push branch before creating fallback issue for protected-files fallback-to-issue
May 30, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes protected-files: fallback-to-issue so that the branch is still pushed when using either bundle transport or patch (am) transport, enabling the protected-files fallback issue to include a GitHub compare URL (instead of showing push-failed “download artifact + git am” instructions when the push actually succeeded).
Changes:
- Remove the “skip push when
manifestProtectionFallbackis set” guard for both bundle and patch transports. - Route
manifestProtectionFallbackhandling through existing pushcatchblocks, so only genuine push failures result in push-failed instructions. - Update tests to assert that
pushSignedCommitsruns and that fallback issues contain/compare/...URLs (and do not containgh run download/git aminstructions).
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/create_pull_request.cjs | Always attempts branch push even under protected-files fallback, deferring to protected-files review issue logic only on genuine push failures. |
| actions/setup/js/create_pull_request.test.cjs | Updates protected-files fallback-to-issue tests to assert push occurs and that issue body includes a compare URL (not artifact-apply instructions). |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
protected-files: fallback-to-issuefired with the defaultpatch-format: bundletransport, the branch was never pushed to origin. The fallback issue rendered the push-failed template (gh run download+git amrecipe) instead of a compare URL — defeating the point offallback-to-issuesince reviewers couldn't inspect the diff in GitHub's UI.The same skip logic existed in the patch (am) path, but its catch block already handled
manifestProtectionFallbackcorrectly — the skip guard just prevented it from ever running.Changes
Bundle transport (
hasBundleFilepath): remove the unconditionalif (manifestProtectionFallback) { skip push; set error }guard. MovemanifestProtectionFallbackhandling into the existing pushcatchblock so genuine push failures (e.g. missingworkflowspermission) still render the push-failed template; successful pushes now reach the compare-URL template.Patch (am) transport: same removal — the
catchblock already had the right logic; the skip guard was preventing it from being reached.Tests: update both
fallback-to-issuetests to assert the corrected behaviour —pushSignedCommitsis called, issue body contains/compare/…URL, does not containgh run download/git am.Before (bundle path):
After: