Branch + PR filtering

Hello,

In a lot of CI workflows, we have 2 main workflows:
1- Analyze code when Pull Request is made.
2- Deploy when code is merged on specific branches (ex: master)

It seems circleci only supports one or the either but not both options at the same time.

Am I assuming this correctly?

Heya @jsaadep, CircleCI does offer the ability to only build on pull requests, which will also build the default branch (typically master). This can be found under the Advanced Settings for the project :slight_smile:

Indeed, but it does not allow some other usual CI scenarios:

Build on PR
Also build on specific branches (not only on master).

This would be a nice feature to have. We’re currently using CircleCI and this was unfortunately a limitation for us.
We wanted to achieve a Trigger on every commit to master, distribute/* and release/* branches. Every other branch requires an open PR.

Recently tried Azure Pipelines for a Xamarin app and they support it. Example azure config below:

# Trigger pipelines for branches on every commit 
trigger:
  branches:
    include:
    - master
    - releases/*
    exclude:
    - releases/old*

# Trigger pipelines for branches with an Open PR
pr:
  branches:
    include:
    - master
    - releases/*
    exclude:
    - releases/old*
1 Like

Hello @escakot - Thank you for the feedback here. This is definitely a feature request that we are tracking here: https://ideas.circleci.com/cloud-feature-requests/p/allow-branch-whitelist-to-override-only-build-pull-requests

1 Like