Running specific tests only on a pull request

One of the environment variables we make available in every build is the CI_PULL_REQUEST variable which is only populated when the build is part of a PR. So checking that variable should work in this case:

test:
  override:
    - if [[ ! -z $CI_PULL_REQUEST ]] ; then <long-running-command> ; fi

If the PR is coming from a fork, the fork PR variables will be set, so you might condition the test execution on that instead.