feat: enhance CreateMergeRequest options with assignee, reviewer, and label support

This commit is contained in:
Martim Pimentel
2025-05-23 18:44:43 +01:00
parent fef360664e
commit bf369a43da
2 changed files with 20 additions and 0 deletions

View File

@ -1001,6 +1001,9 @@ async function createMergeRequest(
description: options.description, description: options.description,
source_branch: options.source_branch, source_branch: options.source_branch,
target_branch: options.target_branch, target_branch: options.target_branch,
assignee_ids: options.assignee_ids,
reviewer_ids: options.reviewer_ids,
labels: options.labels?.join(","),
allow_collaboration: options.allow_collaboration, allow_collaboration: options.allow_collaboration,
draft: options.draft, draft: options.draft,
}), }),

View File

@ -267,6 +267,13 @@ export const CreateMergeRequestOptionsSchema = z.object({
description: z.string().optional(), // Changed from body to match GitLab API description: z.string().optional(), // Changed from body to match GitLab API
source_branch: z.string(), // Changed from head to match GitLab API source_branch: z.string(), // Changed from head to match GitLab API
target_branch: z.string(), // Changed from base to match GitLab API target_branch: z.string(), // Changed from base to match GitLab API
assignee_ids: z
.array(z.number())
.optional(),
reviewer_ids: z
.array(z.number())
.optional(),
labels: z.array(z.string()).optional(),
allow_collaboration: z.boolean().optional(), // Changed from maintainer_can_modify to match GitLab API allow_collaboration: z.boolean().optional(), // Changed from maintainer_can_modify to match GitLab API
draft: z.boolean().optional(), draft: z.boolean().optional(),
}); });
@ -423,6 +430,7 @@ export const GitLabMergeRequestSchema = z.object({
draft: z.boolean().optional(), draft: z.boolean().optional(),
author: GitLabUserSchema, author: GitLabUserSchema,
assignees: z.array(GitLabUserSchema).optional(), assignees: z.array(GitLabUserSchema).optional(),
reviewers: z.array(GitLabUserSchema).optional(),
source_branch: z.string(), source_branch: z.string(),
target_branch: z.string(), target_branch: z.string(),
diff_refs: GitLabMergeRequestDiffRefSchema.nullable().optional(), diff_refs: GitLabMergeRequestDiffRefSchema.nullable().optional(),
@ -612,6 +620,15 @@ export const CreateMergeRequestSchema = ProjectParamsSchema.extend({
description: z.string().optional().describe("Merge request description"), description: z.string().optional().describe("Merge request description"),
source_branch: z.string().describe("Branch containing changes"), source_branch: z.string().describe("Branch containing changes"),
target_branch: z.string().describe("Branch to merge into"), target_branch: z.string().describe("Branch to merge into"),
assignee_ids: z
.array(z.number())
.optional()
.describe("The ID of the users to assign the MR to"),
reviewer_ids: z
.array(z.number())
.optional()
.describe("The ID of the users to assign as reviewers of the MR"),
labels: z.array(z.string()).optional().describe("Labels for the MR"),
draft: z.boolean().optional().describe("Create as draft merge request"), draft: z.boolean().optional().describe("Create as draft merge request"),
allow_collaboration: z allow_collaboration: z
.boolean() .boolean()