Forums

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

Trigger bitbucket on pull requyest comment

Kamil Walo
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!
September 19, 2025
I am trying to set up automated pipeline triggers in Bitbucket by commenting on a pull request. The goal is to write a specific comment, e.g., "//deploy" on bitbucket comment, and have it trigger a pipeline on bitbucket.
Similar functionality exists in GitHub Actions and Azure DevOps — they support triggering workflows or pipelines via commenting (for example, through webhooks or built-in integrations).

My question is: is there a way to achieve this in Bitbucket? I know that Bitbucket supports webhooks that can be sent when a new comment is created. But how can I leverage this webhook to trigger a pipeline automatically — specifically, how can I configure Bitbucket to send the webhook into itself or otherwise trigger the pipeline based on a comment?

I’ve tried using the API endpoint like this:

https://api.bitbucket.org/2.0/repositories/kamil/test/pipelines/?target=%7B%22target%22%3A%7B%22ref_type%22%3A%22branch%22%2C%22type%22%3A%22pipeline_ref_target%22%2C%22ref_name%22%3A%22main%22%7D%7D

but it doesn’t work

 

this one does work but I cannot add body to webhook on 

Repository -> repository settings -> Webhooks

 

curl -X POST  \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  -d '
  {
    "target": {
      "ref_type": "branch",
      "type": "pipeline_ref_target",
      "ref_name": "main"
    }
  }'

Any guidance on how to set this up? Thanks!

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin Site Admin
TAGS
AUG Leaders

Atlassian Community Events