Repository navigation
Conversation
Add --post-command and --post-command-commit-message options that run an arbitrary shell command after cherry-pick(s) succeed but before the result is committed and pushed. If the command produces changes, they are staged and included in an additional fixup commit. This is useful when backporting across major version branches where the cherry-picked code contains import paths or references that are correct on the source branch but wrong on the target branch (e.g. Go module paths, Python package versions, namespace renames). Closes kiegroup#237
Coverage report
Show new covered files 🐣
Show files with reduced coverage 🔻
Test suite run success245 tests passing in 20 suites. Report generated by 🧪jest coverage report action from 7ad68bb |
lampajr
left a comment
There was a problem hiding this comment.
Thanks @mandre , overall looks good and working!! It seems pretty easy to give it a try imho 🚀
I just left one nit-picking comment and maybe it might be better to move the "runScript" method into another service as it is not git-related.
| * @param cwd working directory | ||
| * @param command shell command to execute | ||
| */ | ||
| async runPostCommand(cwd: string, command: string): Promise<void> { |
There was a problem hiding this comment.
I'd rename this to something a bit more generic, e.g., runScript, as this might be used in the future for other hooks (e.g., pre-command)
Move shell execution from `GitCLIService` into `ScriptService.runScript` and inject it separately into the backport steps. Keep the public `--post-command` options and Git commit behavior unchanged. Use a fake script executor when reconstructing failures and separate its command from the following Git commands with a newline. Cover execution order, script errors, logging, and reconstruction without re-execution.
|
Sorry for the lag. I've extracted |
Hey @mandre , overall looks good to me but there are a couple of things that should be fixed
|
fixes #237
Description
Add --post-command and --post-command-commit-message options that run an arbitrary shell command after cherry-pick(s) succeed but before the result is committed and pushed. If the command produces changes, they are staged and included in an additional fixup commit.
This is useful when backporting across major version branches where the cherry-picked code contains import paths or references that are correct on the source branch but wrong on the target branch (e.g. Go module paths, Python package versions, namespace renames).
How Has This Been Tested?
Untested, apart from the newly added unit tests. This was produced with the help of opus-4.6. The code looks good to me, but since I'm not a big javascript person, my view doesn't really count 😄
Checklist
Merge criteria:
First time here?
This project follows git conventional commits pattern, therefore the commits should have the following format:
Where the type must be one of
[build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test]How to prepare for a new release?
There is no need to manually update
package.jsonversion andCHANGELOG.mdinformation. This process has been automated in Prepare Release Github workflow.Therefore whenever enough changes are merged into the
mainbranch, one of the maintainers will trigger this workflow that will automatically updateversionandchangelogbased on the commits on the git tree.More details can be found in package release section of the README.