# Excluding master branch but allowing PRs based off of master

**URL:** <https://travis-ci.community/t/excluding-master-branch-but-allowing-prs-based-off-of-master/12341>\
**Category:** Travis CI Discussions & Feedback\
**Created:** [November 2, 2021, 1:47am UTC](https://travis-ci.community/t/excluding-master-branch-but-allowing-prs-based-off-of-master/12341 "2021-11-02T01:47:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrmuizel](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/jrmuizel/32/7371_2.png) [@jrmuizel](https://travis-ci.community/u/jrmuizel)\
**Post date:** [November 2, 2021, 1:47am UTC](https://travis-ci.community/t/excluding-master-branch-but-allowing-prs-based-off-of-master/12341/1 "2021-11-02T01:47:23Z")

</div>

I’d like to disable travis builds on the master branch of a repo but still run on PRs that target that branch.

Adding the following seems to disable builds on the master and also any PRs that target it.

```auto
branches:
  except:
  - master
``

Is there a way to achieve this?
```

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [November 2, 2021, 4:08am UTC](https://travis-ci.community/t/excluding-master-branch-but-allowing-prs-based-off-of-master/12341/2 "2021-11-02T04:08:39Z")

</div>

As per [Conditional Builds, Stages and Jobs - Travis CI](https://docs.travis-ci.com/user/conditional-builds-stages-jobs#conditional-builds) and [Conditions - Travis CI](https://docs.travis-ci.com/user/conditions-v1) and  
assuming you only want to exclude non-PR builds on `master` and not anything else:

```auto
if: branch != master OR type = pull_request

```

If you also wish to allow other non-push builds on `master` ([which are cron- and API- triggered builds](https://docs.travis-ci.com/user/conditions-v1#integration)) then

```auto
if: branch != master OR type != push

```
