Skip to content

Handle complex create_pull_request commit shapes via direct-push fallback - #32404

Closed
pelikhan with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-complex-create-pull-request-changes
Closed

pelikhan with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-complex-create-pull-request-changes

Conversation

Copilot AI commented May 15, 2026 •

Copy link
Copy Markdown
Contributor

Bug Fix

What was the bug?

create_pull_request could not apply “complex” change bundles when the signed GraphQL createCommitOnBranch path encountered unsupported commit shapes (notably merge commits, symlinks, and submodule entries). In the referenced workflow run, this caused PR creation to degrade into fallback issue creation instead of producing the intended PR branch update.

How did you fix it?

  • Unsupported-shape handling in signed push path
    • In push_signed_commits.cjs, PushSignedCommitsUnsupportedShape now triggers an immediate direct git push fallback attempt instead of hard-failing.
  • Signed-enforcement-aware failure messaging
    • Added explicit detection for signed-commit enforcement rejections (e.g. GH013 / verified-signatures rules) and surfaced a targeted error when fallback push is blocked by repository policy.
  • Behavioral coverage updates
    • Updated push_signed_commits.test.cjs expectations so merge/symlink/submodule scenarios validate fallback-to-push behavior.
    • Added a merge scenario that verifies the signed-enforcement rejection path and message quality.

Example

if (err instanceof PushSignedCommitsUnsupportedShape) {
  try {
    return await pushBranchAndResolveHead({ branch, cwd, gitAuthEnv });
  } catch (fallbackErr) {
    if (isSignedCommitEnforcementError(String(fallbackErr?.message || fallbackErr))) {
      throw new Error("...direct git push was rejected because the repository requires verified signatures...");
    }
    throw new Error("...direct git push fallback also failed...");
  }
}

Copilot AI and others added 2 commits May 15, 2026 14:41
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Fix complex create_pull_request changes fallback handling Handle complex create_pull_request commit shapes via direct-push fallback May 15, 2026
Copilot AI requested a review from pelikhan May 15, 2026 14:43
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot ensure that the unsigned commit is allowed. Check the signed-commits field value

@pelikhan
pelikhan marked this pull request as ready for review May 15, 2026 14:48
Copilot AI review requested due to automatic review settings May 15, 2026 14:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Changes pushSignedCommits so that when commit shapes unsupported by GitHub's createCommitOnBranch GraphQL mutation are detected (merge commits, symlinks, submodules), the function now falls back to a direct git push rather than throwing. Adds explicit detection of signed-commit enforcement rejections (GH013) so the resulting error message is actionable when the repository policy blocks the unsigned fallback.

Changes:

  • In push_signed_commits.cjs, replace the hard "refusing unsigned push" error in the PushSignedCommitsUnsupportedShape catch path with a pushBranchAndResolveHead fallback, and add a new isSignedCommitEnforcementError helper for targeted GH013-style error messages.
  • Update existing symlink/submodule/merge-commit/deleted-submodule tests to assert the new fallback-push success behavior, and add a new test verifying the signed-enforcement rejection path produces the dedicated error message.
Show a summary per file
File Description
actions/setup/js/push_signed_commits.cjs Routes unsupported-shape catch to direct git push fallback; adds isSignedCommitEnforcementError helper and tailored failure messages when verified-signatures policy blocks the fallback.
actions/setup/js/push_signed_commits.test.cjs Reworks symlink/submodule/merge/deleted-submodule tests to expect fallback-push success and SHA equality with local HEAD; adds a new GH013 rejection scenario; refactors a pre-receive hook string into a template literal.

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

Copilot AI and others added 2 commits May 15, 2026 14:52
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented May 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot ensure that the unsigned commit is allowed. Check the signed-commits field value

Addressed in 38c3797. Unsupported commit-shape handling now checks the signed-commits setting and only permits unsigned fallback when that setting allows it; with signed commits enabled, it now fails with guidance to set signed-commits: false.

@pelikhan pelikhan closed this May 15, 2026
@github-actions
github-actions Bot deleted the copilot/fix-complex-create-pull-request-changes branch May 23, 2026 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants