Skip to content

Commit bcacbc2

Browse files
authored
Merge pull request #10543 from gitbutlerapp/copilot/fix-e555705e-1cae-497e-87bd-aa814744e16a
Fix GitLab MRs not being created as draft
2 parents 32a5c01 + 03fd2da commit bcacbc2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

apps/desktop/src/lib/forge/gitlab/gitlabPrService.svelte.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,15 @@ function injectEndpoints(api: GitLabApi) {
125125
PullRequest,
126126
{ head: string; base: string; title: string; body: string; draft: boolean }
127127
>({
128-
queryFn: async ({ head, base, title, body }, query) => {
128+
queryFn: async ({ head, base, title, body, draft }, query) => {
129129
try {
130130
const { api, upstreamProjectId, forkProjectId } = gitlab(query.extra);
131131
const upstreamProject = await api.Projects.show(upstreamProjectId);
132-
const mr = await api.MergeRequests.create(forkProjectId, head, base, title, {
132+
133+
// GitLab uses title prefix to mark drafts: "Draft:", "[Draft]", or "(Draft)"
134+
const finalTitle = draft ? `[Draft]: ${title}` : title;
135+
136+
const mr = await api.MergeRequests.create(forkProjectId, head, base, finalTitle, {
133137
description: body,
134138
targetProjectId: upstreamProject.id,
135139
removeSourceBranch: true

0 commit comments

Comments
 (0)