Support non-force branch update strategy #4

Merged
stephen merged 1 commit from feat/2-non-force-update into main 2026-06-17 00:55:58 +00:00
Owner

The action always force-pushed an existing head branch when updating a PR. That conflicts with branch protection on automation branches that forbids force-push, and with branches that must keep linear history.

This adds a push-strategy input:

  • force (default): force-push, unchanged from today.
  • merge / rebase: fold the existing remote branch into the new commit and push without force, so a protected or linear-history branch is preserved.
  • fail-if-diverged (alias no-force): push without force and stop on a non-fast-forward.

A merge/rebase conflict or a rejected non-force push fails the step cleanly and leaves the remote branch untouched rather than overwriting it. Documented in the README (new Update strategy section), MIGRATION.md, and the changelog.

Tested with make all: the offline suite gains cases for the explicit force path (unchanged), merge and rebase against an existing remote branch (fetch + fold, no -f), a non-force push to a fresh branch, the non-fast-forward rejection, a rebase conflict, and an invalid strategy value.

Closes #2.

The action always force-pushed an existing head branch when updating a PR. That conflicts with branch protection on automation branches that forbids force-push, and with branches that must keep linear history. This adds a `push-strategy` input: - `force` (default): force-push, unchanged from today. - `merge` / `rebase`: fold the existing remote branch into the new commit and push without force, so a protected or linear-history branch is preserved. - `fail-if-diverged` (alias `no-force`): push without force and stop on a non-fast-forward. A merge/rebase conflict or a rejected non-force push fails the step cleanly and leaves the remote branch untouched rather than overwriting it. Documented in the README (new Update strategy section), MIGRATION.md, and the changelog. Tested with `make all`: the offline suite gains cases for the explicit force path (unchanged), merge and rebase against an existing remote branch (fetch + fold, no `-f`), a non-force push to a fresh branch, the non-fast-forward rejection, a rebase conflict, and an invalid strategy value. Closes #2.
Add push-strategy input for non-force branch updates
All checks were successful
test / unit (pull_request) Successful in 8s
065a4a89f6
The action always force-pushed an existing head branch, which conflicts
with branch protection that forbids force-push on automation branches.

Add a push-strategy input (default force, unchanged). merge and rebase
fold the existing remote branch into the new commit and push without
force, so protected or linear-history branches are preserved. A conflict
or non-fast-forward push fails the step cleanly instead of overwriting.
fail-if-diverged (alias no-force) pushes without force and stops on a
non-fast-forward.

Closes #2
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rasterstate/create-pull-request-action!4
No description provided.