Run job only when a specific file is changed and committed to master

Hi!

I am looking to run a job only when a specific file is changed in the commit that is to the master branch. I have been trying to figure out how to do this using the rules and it has not been working. (https://docs.gitlab.com/ee/ci/yaml/#rules)

For example, It runs only when example.txt is modified in a commit that is to the master branch.

I tried to do a combination of both if and changes (I put it below), but that was not running the job when I want it too.

rules:
    - if: "$CI_COMMIT_BRANCH == 'master'"
    - changes:
      - ./example.txt

Thanks