tibdex / backport

🔙 GitHub Action to backport pull requests
MIT License
73 stars 65 forks source link

Backports failing due to missing `--mainline` option on `git cherry-pick` #91

Open Neudrino opened 2 years ago

Neudrino commented 2 years ago

Context

I have been testing the backport action on https://github.com/Neudrino/magma/pull/6 with the run https://github.com/Neudrino/magma/runs/7803925676?check_suite_focus=true.

Problem

The run fails with

Backporting to backport/v1.8 on backport-6-to-backport/v1.8.
  /usr/bin/git switch backport/v1.8
  Switched to a new branch 'backport/v1.8'
  branch 'backport/v1.8' set up to track 'origin/backport/v1.8'.
  /usr/bin/git switch --create backport-6-to-backport/v1.8
  Switched to a new branch 'backport-6-to-backport/v1.8'
  /usr/bin/git cherry-pick -x c2379e2d74ebfe72ca90610dda32aa0a68e44f48
  error: commit c2379e2d74ebfe72ca90610dda32aa0a68e44f48 is a merge but no -m option was given.
  fatal: cherry-pick failed
  /usr/bin/git cherry-pick --abort
  error: no cherry-pick or revert in progress
  fatal: cherry-pick failed
  Error: Error: The process '/usr/bin/git' failed with exit code 128

Expected behaviour

The action should work for merged commits.

Additional information

To me it seems as if https://github.com/tibdex/backport/blob/main/src/backport.ts#L106 is missing the --mainline 1 option. Interestingly, it is given in the error description correctly: https://github.com/tibdex/backport/blob/main/src/backport.ts#L167

tvdeyen commented 1 year ago

@tibdex same for us https://github.com/AlchemyCMS/alchemy_cms/actions/runs/5866900917/job/15906603032#step:2:31

Anything planned to fix this?

tvdeyen commented 1 year ago

Fun fact: In your error template you use the missing command line option in the example.

https://github.com/tibdex/backport/blob/7005ef85c4562bc23b0e9b4a9940d5922f439750/src/backport.ts#L168

Is there a reason why you are not using that in your action as well?

tvdeyen commented 1 year ago

Switched to https://github.com/sqren/backport