Skip to content

[plan] Handle submodule updates gracefully in push_signed_commits.cjs by falling back to git push #26256

@github-actions

Description

@github-actions

Objective

Fix push_signed_commits.cjs to gracefully handle submodule entries instead of silently corrupting them.

Context

Reported in issue #26156. Submodule updates appear in git diff --name-status as regular entries, but they point to a commit object (not a blob) in the tree, and are directories in the working area. The current code will fail or produce incorrect output when encountering them.

Additionally, the GitHub GraphQL createCommitOnBranch mutation does not support submodules.

Bug Details

  • Submodules show up in git diff-tree output like regular files but are of type commit in the tree
  • Reading content via git show <sha>:<path> on a submodule path will succeed but return a commit SHA, not file content
  • Trying to add this as a file addition will silently create a wrong file or fail

Fix

In the diff-parsing loop, detect submodule entries by checking the mode in git diff-tree output. When using git diff-tree -r --name-status, also request the mode with --format or use the full diff output format.

Switch to git diff-tree -r -z --raw <sha> to get mode information alongside status, then:

  1. Detect submodule entries (mode 160000)
  2. When a submodule change is detected, log a warning and fall back to git push for the entire series (since createCommitOnBranch doesn't support submodules)
// mode 160000 = gitlink (submodule)
if (srcMode === "160000" || dstMode === "160000") {
  core.warning(`pushSignedCommits: submodule change detected in ${filePath}, falling back to git push`);
  throw new Error("submodule change detected");
}

Files to Modify

  • actions/setup/js/push_signed_commits.cjs

Acceptance Criteria

  • Submodule changes are detected via file mode 160000 in diff output
  • A clear warning is logged when a submodule change is detected
  • The code falls back to git push instead of silently producing wrong commits
  • Normal files (blobs) continue to work correctly
    Related to bug: multiple critical issues in push_signed_commits #26156

Generated by Plan Command for issue #26156 · ● 383.5K ·

  • expires on Apr 16, 2026, 4:34 PM UTC

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions