Excluding master branch but allowing PRs based off of master

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.

  - master

Is there a way to achieve this?

As per Conditional Builds, Stages and Jobs - Travis CI and Conditions - Travis CI and
assuming you only want to exclude non-PR builds on master and not anything else:

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) then

if: branch != master OR type != push