Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

pipeline not working on pull-requests

sumandhakal
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 19, 2025

I am trying to trigger bitbucket pipelines on every pull request to staging and production branches. But it wouldn't trigger.

I have tried passing branches values like staging/*, master/* and even '**', but the pipelines wouldn't just trigger

Following is my config:

bitbucket-pipelines.png

2 answers

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 21, 2025

Hi @sumandhakal and welcome to the community!

Pull requests pipelines cannot be triggered based on the destination branch at the moment. The branch you specify in your bitbucket-pipelines.yml for a pull-requests pipeline matches the source branch of the PR. We have a feature request for pull-requests pipelines based on the destination branch that you can vote for and add yourself as a watcher:

In the meantime, you could use a pull-requests build based on the source branch, and then, during the build, you can check the destination branch of the PR using the default variable $BITBUCKET_PR_DESTINATION_BRANCH, and execute different commands/scripts depending on the destination branch.

Apart from that, there are also some syntax errors in your bitbucket-pipelines.yml that need to be fixed:

1. One of them is what Luke mentioned. The branch names under pull-requests should be properties, not a list, so you need to remove the hyphen before the branch names.

2. The properties name and deployment are properties of a step or a stage, not of a pipeline, so they should be defined for a step or a stage. If you want to use the same deployment environment for multiple steps of the same pipeline, the way to do this is with a stage, like in the following example:

pipelines:
pull-requests:
testing1:
- stage:
name: Deploy to staging
deployment: staging
steps:
- step:
<<: *step1
- step:
<<: *step2


3. The keyword steps inside a pipeline can only be used with a stage, like in the example I shared above. If you don't use a stage, you can simply list the steps without the steps: part. However, if you want to use the same deployment environment for both steps in the pipeline, then a stage with the steps: is the way to go.

Please feel free to reach out if you have any questions!

Kind regards,
Theodora

0 votes
Luke James
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 19, 2025

Your syntax seems to be incorrect, branch names need to be child properties rather than a list.

See https://support.atlassian.com/bitbucket-cloud/docs/pipeline-start-conditions/#Pull-Requests

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin Site Admin
TAGS
atlassian, out of office, loom, confluence, async collaboration, meeting recaps, remote teamwork, team alignment, knowledge sharing, AI-powered notes, productivity tools, workforce continuity, teamwork collection

Put your meeting notes on autopilot with Loom + Confluence

AI-powered meeting notes keep work moving even if you’re out of the office. Enjoy your well-deserved time off and return refreshed, confident you’ll catch up in no time.

Learn more
AUG Leaders

Atlassian Community Events