Skip to content

Commit e692ddc

Browse files
author
Martim Pimentel
committed
feat: enhance CreateMergeRequest options with assignee, reviewer, and label support
1 parent 159da36 commit e692ddc

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,9 @@ async function createMergeRequest(
10011001
description: options.description,
10021002
source_branch: options.source_branch,
10031003
target_branch: options.target_branch,
1004+
assignee_ids: options.assignee_ids,
1005+
reviewer_ids: options.reviewer_ids,
1006+
labels: options.labels?.join(","),
10041007
allow_collaboration: options.allow_collaboration,
10051008
draft: options.draft,
10061009
}),

schemas.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,13 @@ export const CreateMergeRequestOptionsSchema = z.object({
267267
description: z.string().optional(), // Changed from body to match GitLab API
268268
source_branch: z.string(), // Changed from head to match GitLab API
269269
target_branch: z.string(), // Changed from base to match GitLab API
270+
assignee_ids: z
271+
.array(z.number())
272+
.optional(),
273+
reviewer_ids: z
274+
.array(z.number())
275+
.optional(),
276+
labels: z.array(z.string()).optional(),
270277
allow_collaboration: z.boolean().optional(), // Changed from maintainer_can_modify to match GitLab API
271278
draft: z.boolean().optional(),
272279
});
@@ -423,6 +430,7 @@ export const GitLabMergeRequestSchema = z.object({
423430
draft: z.boolean().optional(),
424431
author: GitLabUserSchema,
425432
assignees: z.array(GitLabUserSchema).optional(),
433+
reviewers: z.array(GitLabUserSchema).optional(),
426434
source_branch: z.string(),
427435
target_branch: z.string(),
428436
diff_refs: GitLabMergeRequestDiffRefSchema.nullable().optional(),
@@ -612,6 +620,15 @@ export const CreateMergeRequestSchema = ProjectParamsSchema.extend({
612620
description: z.string().optional().describe("Merge request description"),
613621
source_branch: z.string().describe("Branch containing changes"),
614622
target_branch: z.string().describe("Branch to merge into"),
623+
assignee_ids: z
624+
.array(z.number())
625+
.optional()
626+
.describe("The ID of the users to assign the MR to"),
627+
reviewer_ids: z
628+
.array(z.number())
629+
.optional()
630+
.describe("The ID of the users to assign as reviewers of the MR"),
631+
labels: z.array(z.string()).optional().describe("Labels for the MR"),
615632
draft: z.boolean().optional().describe("Create as draft merge request"),
616633
allow_collaboration: z
617634
.boolean()

0 commit comments

Comments
 (0)