Skip to content

Commit 03fd2da

Browse files
ByronCopilot
andcommitted
Add draft parameter to GitLab MR creation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
1 parent 7e1130a commit 03fd2da

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)