Build on pull request or 2 branches


I’m trying to achieve the following with CircleCI:

  1. Any PR triggers integration tests
  2. A completed merge into develop branch triggers a build to a QA environment
  3. A completed merge into master branch triggers a build to a UAT environment

I already have a config.yml file configured to do pretty much everything I need, except one major problem.

When I have ‘Only build pull requests’ enabled, it only triggers CircleCI on a PR or merge into the main branch. This means I only achieve 1 and 3 of my requirements. If I disable ‘Only build pull requests’ then I may be able to achieve all 3 requirements, but it also runs CircleCI on every push, which I don’t want.

Is there a way to achieve my 3 steps with the ‘Only build pull requests’ enabled? Or another better way of doing this?