Handle submodule entries in push_signed_commits by falling back to git push#26298
Handle submodule entries in push_signed_commits by falling back to git push#26298
Conversation
…igned_commits.cjs Agent-Logs-Url: https://github.com/github/gh-aw/sessions/308925ea-5090-4ed0-9c34-5bf1dd1f6e0a Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR prevents corrupt signed commits when a commit includes submodule (gitlink, mode 160000) entries by detecting gitlinks during the diff-tree pre-scan and forcing the existing git push fallback path instead of attempting the GraphQL createCommitOnBranch mutation.
Changes:
- Parse
srcModefromgit diff-tree --rawso submodule deletions (wheredstModeis000000) can be detected. - Detect gitlink mode
160000across delete/rename/copy/add-modify cases and throw to trigger thegit pushfallback. - Add an integration test that creates a gitlink entry via
git update-index --cacheinfo 160000,...and asserts GraphQL is not called and fallback push succeeds.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/push_signed_commits.cjs | Adds srcMode parsing and gitlink (160000) detection to force git push fallback for submodule changes. |
| actions/setup/js/push_signed_commits.test.cjs | Adds an integration test covering submodule/gitlink detection and verifying GraphQL is bypassed. |
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: 2
| if (status === "D") { | ||
| // mode 160000 = gitlink (submodule); GitHub GraphQL createCommitOnBranch does not support submodules | ||
| if (srcMode === "160000") { | ||
| core.warning(`pushSignedCommits: submodule change detected in ${filePath}, falling back to git push`); | ||
| throw new Error("submodule change detected"); | ||
| } |
| } | ||
| deletions.push({ path: filePath }); | ||
| if (srcMode === "160000" || dstMode === "160000") { | ||
| core.warning(`pushSignedCommits: submodule change detected in ${renamedPath}, falling back to git push`); |
🧪 Test Quality Sentinel ReportTest Quality Score: 100/100✅ Excellent test quality
Test Classification Details
Test Quality Highlights✅
|
There was a problem hiding this comment.
✅ Test Quality Sentinel: 100/100. Test quality is excellent — 0% of new tests are implementation tests (threshold: 30%). The new test for submodule fallback is a well-structured behavioral contract test using real git operations and end-to-end state verification.
|
@copilot review comments |
…ing with both paths Agent-Logs-Url: https://github.com/github/gh-aw/sessions/407bea3c-da48-4b10-814f-66cc383482c2 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Addressed both reviewer comments in commit
|
Submodule entries (gitlink mode
160000) appeared as regular diff entries but cannot be pushed via the GraphQLcreateCommitOnBranchmutation — attempting to do so would silently produce corrupt commits.Changes
actions/setup/js/push_signed_commits.cjssrcModealongside existingdstModefromgit diff-tree --rawoutput (needed to detect submodule deletions, wheredstModeis000000)160000across all four diff status branches (Delete, Rename, Copy, Add/Modify) and throw to trigger the existinggit pushfallback:actions/setup/js/push_signed_commits.test.cjsgit update-index --add --cacheinfo 160000,..., verifies GraphQL is never called, and confirms the commit lands on the remote via thegit pushfallback.