Skip to content

Only run snapshot-bump workflow when .version changed#6724

Merged
ajpallares merged 4 commits into
mainfrom
pallares/snapshot-bump-only-on-version-change
May 4, 2026
Merged

Only run snapshot-bump workflow when .version changed#6724
ajpallares merged 4 commits into
mainfrom
pallares/snapshot-bump-only-on-version-change

Conversation

@ajpallares

@ajpallares ajpallares commented Apr 30, 2026

Copy link
Copy Markdown
Member

Checklist

  • If applicable, unit tests
  • If applicable, create follow-up issues for purchases-android and hybrids

Motivation

The snapshot-bump workflow runs on every commit to main, and the underlying lane only de-duplicates against the live bump/<version> branch — not against already-merged bump PRs. So a commit that lands on main while a bump PR is in flight can race against the bump branch being deleted on merge and open a duplicate "prepare next version" PR (this is what produced #6720, 20s after #6719 merged).

Description

  • Restrict the snapshot-bump workflow to only run on commits that actually modify .version.
  • The release commit (where the bump PR is created) and the bump merge commit (where the lane no-ops on the SNAPSHOT version) still trigger it; unrelated commits on main no longer can.
  • Wired through the existing CircleCI dynamic config: the setup job computes a version_file_changed parameter from the triggering commit and forwards it to the workflow's when condition.

Note

Low Risk
Low risk CI-only change that narrows when snapshot-bump runs; main risk is accidentally skipping the workflow if the git diff check fails in unusual pipeline contexts (e.g., shallow clones).

Overview
Stops snapshot-bump from running on every main commit by adding a new version_file_changed pipeline parameter and requiring it to be true in the workflow’s when clause.

The CircleCI setup job now generates and forwards continuation parameters via a new .circleci/generate-continuation-parameters.js script, which detects whether the triggering commit modified .version and writes the result to /tmp/continuation-parameters.json for continuation/continue.

Reviewed by Cursor Bugbot for commit 83ff03e. Bugbot is set up for automated code reviews on this repo. Configure here.

The `snapshot-bump` workflow used to run on every non-scheduled, non-`bump`
commit on `main`. Combined with `create_next_snapshot_version`'s only
de-duplication being "is the bump branch currently on the remote?", any
commit that landed on `main` between a release and the merge of its
follow-up bump PR could open a duplicate bump PR (e.g. #6720 was opened
20s after #6719 merged because `bump/<v>` had just been deleted).

Compute `version_file_changed` in the dynamic-config setup job by diffing
the triggering commit against its parent for `.version`, forward it via
`continuation/continue`'s `parameters` arg, and add it as a `when`
condition on the `snapshot-bump` workflow. Now the workflow only triggers
on commits that actually modified `.version` — i.e. the release commit
itself (where the lane runs the bump) and the bump merge commit (where
the lane no-ops because `.version` is now a SNAPSHOT). Unrelated commits
on `main` no longer race against an in-flight bump PR.

Made-with: Cursor
Mirrors the existing `.circleci/generate-requested-jobs-config.js` pattern
so future derived pipeline parameters can be added without growing the
inline shell in `.circleci/config.yml`.

Made-with: Cursor
The Node script's name and its own comments already convey what this
step does.

Made-with: Cursor
The parameter name is self-explanatory and the rationale already lives
in the generate-continuation-parameters.js script and commit history.

Made-with: Cursor
@ajpallares ajpallares marked this pull request as ready for review April 30, 2026 16:29
@ajpallares ajpallares requested a review from a team as a code owner April 30, 2026 16:29
@ajpallares ajpallares requested a review from a team April 30, 2026 16:29

@tonidero tonidero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting approach! I think this makes sense 👍

@ajpallares ajpallares merged commit d302322 into main May 4, 2026
16 of 18 checks passed
@ajpallares ajpallares deleted the pallares/snapshot-bump-only-on-version-change branch May 4, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants