From 84db4b157d89f2561457ca16901d24bdedf8883d Mon Sep 17 00:00:00 2001 From: Neil Carvalho Date: Fri, 15 May 2026 15:55:04 -0300 Subject: [PATCH 1/2] Force push when creating a new branch If a workflow run fails, the next one may fail because it can't push the new changes to the branch with the same name. This commit passes in `force: true` to `@git.push` to ensure that the commits will be pushed to that branch. --- lib/executor.rb | 2 +- test/executor_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/executor.rb b/lib/executor.rb index d00aaee..b161736 100644 --- a/lib/executor.rb +++ b/lib/executor.rb @@ -120,7 +120,7 @@ def handle_open(action) detail: "No changes after pinning — packages may already be at latest." ) end - @git.push(branch: spec.branch) + @git.push(branch: spec.branch, force: true) number = @gh.create_pr( branch: spec.branch, base: @base, title: spec.title, body: @body_renderer.call(spec), diff --git a/test/executor_test.rb b/test/executor_test.rb index bcc7d0a..021dcc5 100644 --- a/test/executor_test.rb +++ b/test/executor_test.rb @@ -150,7 +150,7 @@ def test_open_action_pins_pushes_and_creates_pr # Git operations: checkout fresh, commit, push. assert_equal [{branch: "importmap-updates/patch", base: "main"}], @git.checkouts assert_equal 1, @git.commits.size - assert_equal [{branch: "importmap-updates/patch", force: false}], @git.pushes + assert_equal [{branch: "importmap-updates/patch", force: true}], @git.pushes # gh create_pr called with planner-provided title and rendered body. assert_equal 1, @gh.created.size From 80fd88b04e2675e1e7e7e03fefc262bbb8d060e9 Mon Sep 17 00:00:00 2001 From: Neil Carvalho Date: Fri, 15 May 2026 16:03:52 -0300 Subject: [PATCH 2/2] Use `--force` instead of `--force-with-lease` `--force-with-lease` is a way to protect a forced push against overwriting commits that only exist in the remote branch. This action always creates branches from scratch based on `main`, so it can't use that feature. Also, there's nothing to protect from. The newly created branches will always be current. --- lib/git_client.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git_client.rb b/lib/git_client.rb index 2966359..98fd0b6 100644 --- a/lib/git_client.rb +++ b/lib/git_client.rb @@ -46,7 +46,7 @@ def commit_all(message:) def push(branch:, force: false) argv = ["git", "push", "origin", "#{branch}:#{branch}"] - argv.push("--force-with-lease") if force + argv.push("--force") if force @runner.run!(*argv) nil end