Target branch workflow not applied when creating a merge request from an issue
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=602567) </details> <!--IssueSummary end--> ## Summary The [Merge request branch workflow](https://docs.gitlab.com/user/project/repository/branches/#configure-workflows-for-target-branches) (configured in **Settings → Merge Requests → Merge request branch workflow**) correctly sets the target branch when creating a merge request directly (e.g., via the **New merge request** button or from a branch). However, the configured workflow rules are **not applied** when creating a merge request [from an issue](https://docs.gitlab.com/user/project/merge_requests/creating_merge_requests/#from-an-issue) using the **"Create merge request"** button on the issue page. ## Steps to Reproduce 1. Configure a target branch workflow rule in **Settings → Merge Requests → Merge request branch workflow** (e.g., branch name pattern `feature/*` → target branch `develop`). 2. Create an issue in the project. 3. On the issue page, click **"Create merge request"** (or use the dropdown to create a branch + MR). 4. Observe the target branch selected for the new merge request. ## Current (Bug) Behavior When creating a merge request from an issue, the target branch workflow rules are **ignored**. The MR is created targeting the project's **default branch** instead of the branch configured by the workflow rule. ## Expected Correct Behavior When creating a merge request from an issue, the target branch workflow rules should be applied in the same way they are when creating a merge request directly. The target branch should be set according to the matching workflow rule based on the source branch name. ## Relevant Documentation - [Configure workflows for target branches](https://docs.gitlab.com/user/project/repository/branches/#configure-workflows-for-target-branches) - [Creating merge requests from an issue](https://docs.gitlab.com/user/project/merge_requests/creating_merge_requests/#from-an-issue) ## Environment - **Deployment type:** GitLab.com ## Possible Fix The "Create merge request from issue" flow likely does not pass through the same target branch resolution logic that the standard MR creation flow uses. The `MergeRequests::BuildService` or the branch/MR creation endpoint triggered from the issue page may need to be updated to apply the project's target branch workflow rules when determining the default target branch. ## Related Issues - [#533350](https://gitlab.com/gitlab-org/gitlab/-/work_items/533350) — Enforce Merge Request branch workflow (feature request to make the workflow enforced/non-overridable) - [#551502](https://gitlab.com/gitlab-org/gitlab/-/work_items/551502) — Include "Target Branch Workflow" settings in project templates/project exports
issue