Building master only on mainline, and branches in forks matching a regex

I’m trying to write my .gitlab-ci.yml so that only master is built on mainline and branches matching a certain regex are built. I’ve got the regex working, however commits to mainline master are skipped. My .gitlab-ci.yml is essentially:

  # ensure all updates are installed
  - apt-get update && apt-get --assume-yes upgrade

  # commands to build project here
  # build only branches starting with mr_ and then master in the
  # mainline repo
  - /^mr_.*$/
  - master@lalsuite-test

in the above the name of the project is lalsuite-test however commits to master don’t trigger builds so clearly this syntax is wrong. How do I specify to build commits to master in mainline and not in any forks?

I believe the issue is that master@lalsuite-test should include the namespace, e.g. master@gitlab-ce doesn’t work, you have to include the group name, like master@gitlab-org/gitlab-ce.

I finally managed to get it working a while ago, and that indeed was the problem,