I am trying to create a BitBucket hook that would get triggered when a PR is merged to one of the release branches. After that it would identify which release branches are newer, open a feature branch for each of the newer release branches. After, it would cherry-pick commits from the PR to each of the new feature branches. This is a similar workflow to Auto-Merge in BitBucket. Unfortunately automated merge doesn't work for our repository.
I am using Custom Hook in BitBucket setting it to trigger on PR merge. However I can't find any way to cherry-pick a commit using BitBucket Server API Neither do I see a way using BitBucket REST API
I don't even see a way to create a commit which could work, If I could provide a changeset.
The only way, I can figure out this can be done, is to use gitCommandBuilderFactory
to checkout the repository and cherry-pick afterwards. But that seems like a very expensive operation for BitBucket server to run, especially if there are multiple release branches to work with.