Support only: merge_requests for GitHub Pull Requests
Problem
We are using the full Gitlab integration functionality to run Gitlab CI against our our Github repository.
By default, Gitlab CI is starting a pipeline for all commits on all branches. We would like to only run builds against open Github Pull Requests.
- With "no extra config" in our
.gitlab-ci.yaml, Gitlab is starting a pipeline for all commits. This does report correctly to open Github PRs, but overtaxes our workers, as they pointlessly build dozens of other pushed commits to branches with no PR. - With
only: [merge_requests], Gitlab builds nothing, as we aren't creating Merge Requests.
Can Gitlab be configured to interpret only: [merge_requests] as "pull requests" when pointed at a Github repository? Is there some other simple way of having Gitlab start pipelines again Github PRs, not all commits/branches?
Proposed solution(s)
- Support `only/except: merge_requests` for exter... (gitlab-foss#65139 - closed)
- Support `rules:if: $CI_PIPELINE_SOURCE == "external_pull_request_event" to only run CI for the branch of the PR. - This works today
Edited by James Heimbuck