Use BitBucket's API to automatically create and merge pull requests. This is useful for including in your Pipelines steps to keep multiple branches insync with each other.
Take an example of where you're merging in hotfixes to the master branch throughout the day, instead of continuously merging the hotfixes branch back up to develop, you can just include this script to automatically make and merge pull requests up to develop.
This is based on the StackOverflow work done by svestka: https://stackoverflow.com/a/47436375/1234292
Required arguments:
-s | --sourceSource git branch to create pull request from.-d | --destinationDestination git branch to merge pull request to.
Optional arguments:
-u | --userBitBucket username. If not set, uses BITBUCKET_AUTOMERGE_USER.-p | --passwordBitBucket user password. If not set, uses BITBUCKET_AUTOMERGE_PASS.--repo-ownerThe repository owner. If not set, uses BITBUCKET_REPO_OWNER.--repo-slugThe slug of the repository. If not set, uses BITBUCKET_REPO_SLUG.--versionDisplay the version of this script
Requirements:
curlcurl is a tool to transfer data from or to a server.jqjq is like sed for JSON data.
Create and automatically merge a pull request from master to develop:
# Merge master into develop
bitbucket-auto-merge -s master -d develop
All options:
bitbucket-auto-merge --source master --destination develop -u mfrank -p 4boo2 --repo-owner teamsystems --repo-slug hello-world
MIT