Right now, a pipeline runs as soon as a Pull Request is created. Meaning, it runs before the pull request has been approved or merged. This is not ideal - what if the pull request requires revisions?
Is there a way to specify in the `bitbucket-pipelines.yml` to only deploy upon a merged pull request, rather than as soon as the PR is created?
My current pipeline looks like this:
pipelines:
pull-requests: # The branch pattern under pull requests defines the source branch.
dev:
- step:
name: Deploy to Production
deployment: Production
script:
- do stuff
- deploy stuff
services:
- docker
For example, in github actions, you can do something like:
prod-push:
if: github.event.action == 'closed' && github.event.pull_request.merged == true
Sounds like you want the pipeline to run off of the merge to main, not on the pull request. Something like:
pipelines:
branches:
main:
- step:
name: Deploy to Production
deployment: Production
script:
- do stuff
- deploy stuff
services:
- docker
You might want to look into building a custom Forge app using the newly minted Bitbucket events: https://bitbucket.org/blog/upcoming-changes-to-pull-requests-and-merge-check-configuration
The new `on-merge` event sounds like what you want here - once the PR is approved, hitting the merge button should trigger any on-merge checks. Technically this happens before the merge - if you really do want to hook into the merge event the existing branch trigger functionality should have you covered there.
Good luck!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.