Fetch `refs/pull/*/head` refs for mirror repository
In https://gitlab.com/gitlab-org/gitlab-ce/issues/65139 we are working on detecting when a branch push occurs in the context of a GitHub pull request so that we run a pipeline for ExternalPullRequest
object. This is a Gitlab CI/CD for external repo that is set up using GitHub integration. This works fine when a pull request is opened from the same repository. However, with fork workflows it does not work because the pull request source_sha
would not exist in the mirror repository.
In Projects::UpdateMirrorService
we update tags, branches and LFS objects. We don't fetch pull request refs.
In order to support fork workflows we would need to make refs/pull/*/head
refs available in the mirror repository. For this purpose we might need 2 separate endpoints:
- Find all remote
refs/pull/*/head
- Like we currently do for branches to know which one has changed and update only those that changed. - Update specific
refs/pull/N/head
to mirror repository. E.g. update onlyrefs/pull/123/head
- This would be useful when updating only the refs that changed as part of the mirror update but also when a pull request is opened and a webhook is sent to GitLab about it. In the latter case we want to immediately issue an update of the ref before creating a pipeline.