I’m not sure I understand the issue, I have a few clarification questions:
Do you mean that when you create a pull request, the pipeline is not triggered? (That would be a functionality of Bitbucket Cloud.)
When you say that “It works fine when I accept the pull request”, do you mean that when the pull request is merged into the main branch, the pipeline triggers as expected? Or something else?
I finally got it working. The problem wasn’t the YML or anything with the code. I found this snipped from the BitBucket pipeline triggers documentation:
pull-request: A special pipeline that only runs on pull requests initiated from within your repo. It merges the destination branch into your working branch before it runs. Pull requests from a forked repository don’t trigger the pipeline
It only works when the pull request is created from the same repo, not the forked one.