Skip to content

signed-commit commits conflict markers when the autostash fails to apply #64

In review

Description

@vdusek

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.

  1. The Pull latest changes step runs git pull --rebase --autostash. The autostash fails to apply. Git prints Your 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.
  2. The Stage files step runs git add .. This resolves the unmerged entries and stages the files with the markers in them.
  3. main() runs git pull --rebase --autostash again, which is a no-op (Already up to date.). Then git ls-files --unmerged returns 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 changes

Expected behavior

The action fails before it stages or commits anything when the pull leaves unmerged paths. Possible fixes:

  • Remove the Pull latest changes and Stage files shell steps from action.yml, since main() already pulls and stages.
  • Or run the git ls-files --unmerged check right after the shell pull, before git add.

A test should cover an autostash conflict.

✍️ Drafted by Claude Code

Activity

  1. self-assigned this
    on Dec 2, 2026
  2. added
    bug
    t-tooling
    on Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugt-tooling

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions