Why Adding branches disable the fork pull request build

Adding branches to the jobs or the workflow level disable the fork pull request build

version: 2
defaults: &defaults
  docker:
    - image: circleci/php
jobs:
  build:
    docker:
      - image: circleci/php
    # branches:
    #   only: dev    <----   When I add this filter the fork pull request build doesn't work
    steps:
      - checkout
      - run: echo "Start tests - Dev branch"
  staging:
    <<: *defaults
    steps:
      - checkout
      - run: echo "Deploying to the Staging Server"
  prod:
    <<: *defaults
    steps:
      - checkout
      - run: echo "Deploying to the Production Server"

workflows:
  version: 2
  stage_prod:
    jobs:
      - build
      # - build:
          # filters:
          #   branches:
          #     only: dev    <----   When I add this filter the fork pull request build doesn't work
      - staging:      
          filters:
            branches:
              only: test
      - hold:
          type: approval
          filters:
            branches:
              only: master
      - prod:
          requires:
            - hold

I found out that the branch name is pull/* and that’s why the build job is not running!!

Is there any way to run the build job only if the pull request is dedicated to the dev branch ONLY ?

All our pull requests come from the dev branches. We need to filter by base branch of the PR. Can someone help here?