Repository navigation
Description
When pull: --rebase --autostash is set and the autostash conflicts with the pulled commits, signed-commit commits the files with the git conflict markers in them. The git ls-files --unmerged check in index.mts is meant to stop this, but it never sees the conflict.
On 2026-12-01 this happened in apify/apify-sdk-python three times. Two beta release runs were re-run 3 minutes apart, and both python-bump-and-update-changelog and the docs theme update commit through signed-commit. The result was conflict markers in CHANGELOG.md (apify/apify-sdk-python@36b7189) and in website/pnpm-lock.yaml (apify/apify-sdk-python@851d4df, apify/apify-sdk-python@8315dd7). The broken lockfile then failed pnpm install --frozen-lockfile on every PR until apify/apify-sdk-python#1299 fixed it.
Root cause
The pull and add inputs are handled twice: first by the Pull latest changes and Stage files shell steps in signed-commit/action.yml, then again by main() in signed-commit/index.mts.
- The
Pull latest changesstep runsgit pull --rebase --autostash. The autostash fails to apply. Git printsYour local changes are stashed, however applying them resulted in conflicts, but it still exits 0. The conflicted files are left as unmerged index entries, with markers in the working tree. - The
Stage filesstep runsgit add .. This resolves the unmerged entries and stages the files with the markers in them. main()runsgit pull --rebase --autostashagain, which is a no-op (Already up to date.). Thengit ls-files --unmergedreturns nothing, and the action commits.
The retries loop in main() needs the pull there, so the duplicate is the pull in the shell step.
Reproduction
With git 2.56.1:
git init -q --bare origin.git
git clone -q origin.git a && cd a
printf 'head\n\nend\n' > f.md && git add f.md && git commit -qm init && git push -q origin HEAD:master
cd .. && git clone -q origin.git b
(cd a && printf 'head\nfeat\nend\n' > f.md && git commit -qam upstream && git push -q)
cd b && printf 'head\nfeat\nfix\nend\n' > f.md
git pull --rebase --autostash # "Pull latest changes" step: conflict, exit 0
git ls-files --unmerged # 3 entries for f.md
git add . # "Stage files" step
git pull --rebase --autostash # main(): "Already up to date."
git ls-files --unmerged # empty, so the check passes
git diff --cached # f.md staged with <<<<<<< Updated upstream / >>>>>>> Stashed changesExpected behavior
The action fails before it stages or commits anything when the pull leaves unmerged paths. Possible fixes:
- Remove the
Pull latest changesandStage filesshell steps fromaction.yml, sincemain()already pulls and stages. - Or run the
git ls-files --unmergedcheck right after the shell pull, beforegit add.
A test should cover an autostash conflict.
✍️ Drafted by Claude Code
Activity