CI: Make it possible to build only merge requests
Description
When working in a team, we want to build all merge requests in the repo, but not each and every commit. Currently, we can either use the branches keyword or a pattern like /^feature\/.+/. However, those options lead to too many builds or to confusion why a build was skipped (turns out, typos in branch names are more common than you'd think).
I'd like to have an option to just build all merge requests. No matter what the branch name of the source branch, the build get's triggered once a MR is open for it. An option like this would be especially handy for projects which have the Only allow merge requests to be merged if the build succeeds setting enabled.
Proposal
In .gitlab-ci.yml we should be able to specify
job:
only:
- mergerequests
…
just as it is already possible for tags, branches and triggers.
This specification should build every merge request, but no other refs in the repository.
Links / references
http://docs.gitlab.com/ce/ci/yaml/README.html#only-and-except