Create cross-repository merge requests with GraphQL

I’m trying to create merge requests using GraphQL mutation mergeRequestCreate. That works fine for creation of merge requests within the same repository (both target and source branches belong to the same repository). I’m struggling to create a cross-repository merge request between forked child and fork parent. I can’t figure out how to specify sourceBranch input parameter. I tried to prefix it with the source repository namespace (like dmilke:branch_name, which works on some other hosting services), but I get Source branch is invalid error.

I’d appreciate if anyone can help me with this. Thanks.

Falling back to REST API to read and create merge requests, I realised the merge request creation logic on GitLab is reversed, compared to other services. The operation is not performed on the target project (where the merge request is to be created), but on the source project. When creating merge request between branches of the same project, this distinction doesn’t matter, so it’s easy to overlook. Anyway, with that in mind, creating a merge request using the REST API allows for specifying target_project_id parameter and with the source_project_id being a part of endpoint URI, this enables creation of cross-repository merge request between forked child and fork parent. Back to GraphQL API, this means an input parameter (something like targetProjectPath or targetProjectId) is missing, which is a shame.

I hope this will be added to GraphQL API specification in the future, so we don’t have to fall back to the REST API for merge request creation.