Skip to content

Stop the lockfile workflow from committing version-only churn - #1671

Merged
tsalo merged 1 commit into
mainfrom
fix-lockfile-loop
Nov 3, 2026
Merged

tsalo merged 1 commit into
mainfrom
fix-lockfile-loop

Conversation

@tsalo

@tsalo tsalo commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Ports PennLINC/qsirecon#416.

Changes proposed in this pull request

The update-lockfile job in .github/workflows/pixi-lock.yml can loop on same-repo pull requests. pixi lock --check exits 0 and prints "Lockfile up to date", but it still rewrites pixi.lock with the workspace package's hatch-vcs version (26.x.y.devN+g<sha>), which changes with every commit. datalad run then commits the rewritten file, the bot's push triggers a new pull_request run, and the cycle repeats. This happened on PennLINC/qsirecon#396 after the switch from pull_request_target to pull_request (#1640 here). XCP-D's workflow is identical to qsirecon's, so it has the same problem; it hasn't shown up yet only because no PR has touched pyproject.toml or pixi.lock since the switch.

This PR copies the two guards from the qsirecon PR without changes:

  • Push only when something other than the workspace package version changed. A new step after the datalad step runs git diff --exit-code -I '^ (version|sha256|editable): ' <head-sha> HEAD -- pixi.lock. If those are the only lines that differ, the push is skipped and the job still succeeds. A real dependency change also touches the - pypi:/- conda: URL lines or requires_dist, so it is still pushed.
  • Skip the update when the head commit is the bot's own. If git log -1 --format=%an reports nipreps[bot], the job sets run_lockfile_update=false, so a run triggered by the bot's push never pushes again.

I checked the regex against XCP-D's own pixi.lock history (the last 13 commits that touched it, using git 2.50). The two version-only commits (6852d23 and 2f84879, which changed only the version:/sha256: lines of the pypi: ./ entries) exit 0 and would be skipped. The 11 real dependency changes (including the dependabot ruff bump 0d5ecdc, whose only dependency change was one requires_dist line) exit 1 and would be pushed.

The datalad run command, the fork-only validate-lockfile job and the check-lockfile gate are unchanged. pyproject.toml and pixi.lock are not touched.

Documentation that should be reviewed

None.

Use of LLM tools

Required: check exactly one option. A CI check fails until exactly one box is checked.

  • No LLM tools were used in this pull request.
  • LLM tools were used to generate at least part of the content of this pull request.
  • This pull request was generated entirely by an LLM.

Required: check the below if and only if you are a human. Contributions from bot accounts will not be accepted.
A CI check fails if this box is not checked.

  • I am a human being and I both understand and support the changes I propose in this pull request.

🤖 Generated with Claude Code

Port PennLINC/qsirecon#416. pixi lock rewrites the workspace package's
hatch-vcs version on every run, so the update job could push a version-only
lockfile commit that retriggers itself. Skip the push when only the
version, sha256 and editable lines changed, and skip the update when the
head commit is from nipreps[bot].
@tsalo
tsalo merged commit 5d2ad0a into main Nov 3, 2026
9 of 10 checks passed
@tsalo
tsalo deleted the fix-lockfile-loop branch November 3, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant