Pull requests make it simple for teams to collaborate on projects, allowing developers to work independently on feature branches and enabling code review to take place when work is complete and ready to be merged.
To improve the pull request experience in Bitbucket Cloud you can now configure Bitbucket Pipelines to run when you create or update a pull request, providing developers a faster feedback loop on breaking changes and giving reviewers more confidence when approving changes. It was the highest voted feature request for good reason, and we're super excited to share this feature with you.
With a pull-requests pipeline a temporary merge containing the changes in the pull request and the destination branch is created, and the defined pipeline is run on the merge result. By doing this both the pull request creator and reviewers can confirm changes are valid, that the code builds, and tests pass before the pull request is merged into the destination branch. This helps developers find out earlier in their workflow if their changes would break anything, and reviewers can be more confident when approving a pull request.
The pull-requests pipeline also gives you the flexibility to configure certain things to run only when the changes are ready to be merged. For example you can configure Pipelines to run your full test suite when a pull request is open to merge into your master branch, or have a smaller set of tasks run when updating your feature branch via the branches pipeline.
Configuring a pull-requests pipeline
Configuring Pipelines to run when a pull request is open is as simple as adding the pull-requests keyword to your bitbucket-pipelines.yml file. The pull-requests keyword has the same level of indentation as branches.
pipelines: pull-requests: feature/*: # this will run on any branch with a feature/ prefix that has a PR open - step: script: - ... branches: master: # this will run on every push of the master branch - step: script: - ...
For more information about pull request pipelines, check out our documentation. We hope you enjoy this addition to Pipelines and your pull request experience!