Skip to content

Amend latest commit instead of creating a new one for version bump#723

Merged
CasperWA merged 2 commits into
masterfrom
cwa/replace-push-protected
Apr 21, 2026
Merged

Amend latest commit instead of creating a new one for version bump#723
CasperWA merged 2 commits into
masterfrom
cwa/replace-push-protected

Conversation

@CasperWA

@CasperWA CasperWA commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Reverts the commit strategy from creating a new [bot] Update version and CHANGELOG commit back to amending the triggering commit with the version bump and changelog changes.
  • Adds --force-with-lease to the push — required because the amended SHA differs from origin/master, and fails safely if another push has landed since checkout.
  • Uses 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_pushes is enabled on master via the ruleset admin bypass for TEAM4-0, so the push goes through. --force-with-lease adds an extra guard: if any concurrent push has landed since checkout, the push fails rather than silently overwriting it.

Test plan

  • Confirm that after merging, a push to master triggers one CD run that amends the head commit with the version bump, force-pushes, and stops — with no subsequent looping CD run.
Click to view squash commit message

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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-edit for version + changelog updates.
  • Replace protected-branch push action with a direct git push --force to master, 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.

Comment thread .github/workflows/cd_release.yml Outdated
CasperWA and others added 2 commits April 21, 2026 15:35
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>
@CasperWA
CasperWA force-pushed the cwa/replace-push-protected branch from 7dfa250 to ad26169 Compare April 21, 2026 13:35
@codecov

codecov Bot commented Apr 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.34%. Comparing base (dfc6636) to head (ad26169).
⚠️ Report is 1 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@CasperWA
CasperWA merged commit aa012b8 into master Apr 21, 2026
20 checks passed
@CasperWA
CasperWA deleted the cwa/replace-push-protected branch April 21, 2026 13:49
TEAM4-0 pushed a commit that referenced this pull request Apr 21, 2026
)

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.
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.

3 participants