Amend latest commit instead of creating a new one for version bump#723
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the release workflow strategy to avoid an infinite version-bump loop by amending the triggering commit (instead of creating an additional bot commit), and adjusts CI triggers accordingly.
Changes:
- Change CD release to
git commit --amend --no-editfor version + changelog updates. - Replace protected-branch push action with a direct
git push --forcetomaster, using a PAT for checkout authentication. - Remove the
push-action/**branch trigger from the CI tests workflow.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| .github/workflows/ci_tests.yml | Removes the push-action/** push trigger so CI runs only on master pushes and PRs. |
| .github/workflows/cd_release.yml | Switches version bump to amend-in-place and force-pushes the updated master commit using RELEASE_PAT. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The version's patch number equals the commit count. Creating a new commit changes that count, causing invoke setver to find another version bump on the next CD run — an infinite loop. Amending the triggering commit keeps the count unchanged, so the subsequent CD run finds no version change and stops. Force push is needed because the amended SHA differs from origin, but is safe here since allow_force_pushes is enabled and TEAM4-0 has the ruleset admin bypass.
- `--amend -C HEAD` instead of `--amend --no-edit`: preserves the original commit's author (not just message); bot becomes committer only - `--force-with-lease` instead of `--force`: fails if origin has advanced since checkout, preventing accidental overwrite of concurrent pushes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
7dfa250 to
ad26169
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #723 +/- ##
=======================================
Coverage 84.34% 84.34%
=======================================
Files 26 26
Lines 805 805
=======================================
Hits 679 679
Misses 126 126 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
) Amend latest commit instead of creating a new one The version's patch number equals the commit count. Creating a new commit changes that count, causing invoke setver to find another version bump on the next CD run — an infinite loop. Amending the triggering commit keeps the count unchanged, so the subsequent CD run finds no version change and stops. Uses --amend -C HEAD to preserve the original commit author (bot becomes committer only) and --force-with-lease to prevent overwriting any concurrent push that landed since checkout.
Summary
[bot] Update version and CHANGELOGcommit back to amending the triggering commit with the version bump and changelog changes.--force-with-leaseto the push — required because the amended SHA differs fromorigin/master, and fails safely if another push has landed since checkout.git commit --amend -C HEAD— preserves the original commit's author as well as message; the bot becomes committer only.Why amend instead of a new commit
The version's patch number is the total commit count. Creating a new commit increments that count, so the next CD run finds yet another version bump needed — an infinite loop. Amending the triggering commit leaves the count unchanged; the subsequent CD run sees no version change and exits cleanly.
The force-with-lease push is safe:
allow_force_pushesis enabled on master via the ruleset admin bypass for TEAM4-0, so the push goes through.--force-with-leaseadds an extra guard: if any concurrent push has landed since checkout, the push fails rather than silently overwriting it.Test plan
Click to view squash commit message