Repository navigation
Description
There are multiple bugs in actions/setup/js/push_signed_commits.cjs which will silently push incorrect content.
There's probably some more, but there are the ones I noticed while doing some research of existing code before I ended up making my own action for pushing signed commits.
copies in diffs are treated like renames
gh-aw/actions/setup/js/push_signed_commits.cjs
Lines 125 to 130 in 4fba480
| } else if (status.startsWith("R") || status.startsWith("C")) { | |
| // Rename or Copy: parts[1] = old path, parts[2] = new path | |
| deletions.push({ path: parts[1] }); | |
| const content = fs.readFileSync(path.join(cwd, parts[2])); | |
| additions.push({ path: parts[2], contents: content.toString("base64") }); | |
| } else { |
The old file is deleted, even if it's a copy. This needs to be surrounded by another check for if it's specifically a rename versus a copy.
git diff may double-quote filenames
gh-aw/actions/setup/js/push_signed_commits.cjs
Lines 113 to 122 in 4fba480
| // File changes for this commit (supports Add/Modify/Delete/Rename/Copy) | |
| const { stdout: nameStatusOut } = await exec.getExecOutput("git", ["diff", "--name-status", `${sha}^`, sha], { cwd }); | |
| /** @type {Array<{path: string, contents: string}>} */ | |
| const additions = []; | |
| /** @type {Array<{path: string}>} */ | |
| const deletions = []; | |
| for (const line of nameStatusOut.trim().split("\n").filter(Boolean)) { | |
| const parts = line.split("\t"); | |
| const status = parts[0]; |
That is not handled here. The git diff command may c-quote filenames with special characters. The code should check if the names start with double-quotes and unescape them if so.
Also, git diff-tree is better than git diff since it won't be affected by the git config.
the working tree content is always used
gh-aw/actions/setup/js/push_signed_commits.cjs
Lines 128 to 132 in 4fba480
| const content = fs.readFileSync(path.join(cwd, parts[2])); | |
| additions.push({ path: parts[2], contents: content.toString("base64") }); | |
| } else { | |
| // Added or Modified | |
| const content = fs.readFileSync(path.join(cwd, parts[1])); |
This is incorrect since the content in the last commit may not be the same as the working area, and the content in old commits will be incorrect.
The git show REV:PATH command or git ls-tree combined with git cat-files should be used instead.
merge commits are not handled
git rev-listwill list commits from both parentscreateCommitOnBranchdoesn't support creating commits with multiple parents.
submodule updates will fail to be pushed
They appear as a single item in git diff, point to a commit object in the tree (rather than a blob), and will be a directory in the working area.
Furthermore, the GitHub GraphQL API createCommitOnBranch mutation doesn't support submodules (this is an easy fix though, see below).
git rev-list lists by commit date by default
gh-aw/actions/setup/js/push_signed_commits.cjs
Lines 40 to 41 in 4fba480
| const { stdout: revListOut } = await exec.getExecOutput("git", ["rev-list", "--reverse", `${baseRef}..HEAD`], { cwd }); | |
| const shas = revListOut.trim().split("\n").filter(Boolean); |
Commits with out-of-order commit dates (e.g., ones rebased with --committer-date-is-author-date) will not be pushed in the correct order. The --topo-order option should be used to ensure they are listed in graph order.
non-100644 file modes are silently discarded
Things like shell scripts typically have 100755 permissions, but these will be silently dropped when the file is modified and pushed since the createCommitOnBranch mutation doesn't support them.
Symlinks will be silently converted to a regular file with the contents of the target, and will fail if it's a directory.
Activity
pelikhan commentedon Apr 14, 2026
/plan
github-actions commentedon Apr 14, 2026
✅ Plan Command completed successfully!
fix: read file content from commit objects in push_signed_commits.cjs
dsyme commentedon Apr 15, 2026
@pgaskin Looks like this is all done now. A new release has been pushed and is available as latest. If you can give it a spin and report back any further problems you see that would be great.
pgaskin commentedon Apr 15, 2026
Oh, I should have been clear that I never tested it as an agentic workflow. I did look at the code locally (after finding it while searching GitHub for
createCommitOnBranch) while evaluating ways to push signed commits before I ended up just making my own since I wanted an ordinary action.I'll review the PRs in a little bit.
Regarding the limitations for non-regular files, would it be possible to get that added to the API since it should be a relatively trivial change? I did post a discussion on the community repo, but I fear it's a black hole given the lack of engagement on all posts from the last few months. https://github.com/orgs/community/discussions/191953
pgaskin commentedon Apr 15, 2026
Reviewing the changes statically:
#26259 is good
, but missing gitlink (submodule) detection (mode.160000)#26277 looks good, but I didn't verify the unquote logic.
#26287 looks good, though I'd personally use
cat-fileinstead ofshowfor simplicity and robustness since you already have the blob hashes from the changes in #26259.#26298 looks good, and adds the gitlink detection missed in #26259.
#26306 looks good.
pelikhan commentedon Apr 15, 2026
Thanks for the review and the suggestions!
community: update community contributions in README