'How can I skip default pipeline on pull request?

In the project I am currently working on, I want to run the bitbucket pipeline according to the following rules.

  • Test and lint steps should run for each commit pushed to Branch.
  • The test-with-coverage and lint steps must be run for each record opened with Pull Request.

The problem here is that if I push a commit to a branch that I have opened a pull request, the pipeline is triggered twice.

pipelines:
  default:
    - step: *lint
    - step: *test
  pull-requests:
    '**':
      - step: *lint
      - step: *test-with-coverage

I looked for a way to skip default pipeline if a pull request exists, but I can't find it. I am open to suggestions and opinions.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source