sorenlouv / backport

A simple CLI tool that automates the process of backporting commits on a GitHub repo
https://github.com/sqren/backport/blob/main/docs/config-file-options.md
Apache License 2.0
247 stars 60 forks source link

Add --custom-script option #267

Open v1v opened 3 years ago

v1v commented 3 years ago

What

Add --custom-script option to honor to call a script that runs before creating the backported pull request. This particular option will allow to customise the backport process after the cherry-picking.

This option will need to the follow: 1) Run the given script 2) Commit any new changes.

Then the backport process should proceed as usual.

Why

My use case is to allow developers to run backport locally and enable certain level of customisation for those backports.

A real use case:

1) ACME project will have a major release 2) The major release will have the major update version in the import paths. 3) While backporting to the previous releases will require to downgrade those import paths, and this when the --custom-script could help.

sorenlouv commented 3 years ago

That sounds doable!

Commit any new changes.

What should the commit message for the new changes be?

If multiple commits were selected for backporting should the script run after each of them are cherry-picked or once when all are?

v1v commented 3 years ago

What should the commit message for the new changes be?

Good question, I'm tempted to say generated by the custom-script <name-of-the-script> , f.i:

backport .... --custom-script downgrade-imports.sh

could generate the commit message generated by the custom-script 'downgrade-imports.sh'

What do you think?

If multiple commits were selected for backporting should the script run after each of them are cherry picket or once when all are?

I'd say the latter, so if needed it could be added a new flag --custom-script-per-cherry-pick or something similar to support one script call per cherry-pick .

WDYT?