Skip to content

Commit de256a4

Browse files
committed
fix: Add missing CreatePullRequestSchema and createPullRequest function
1 parent a12c6ff commit de256a4

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/github/operations/pulls.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ export const PullRequestReviewSchema = z.object({
7676
});
7777

7878
// Input schemas
79+
export const CreatePullRequestSchema = z.object({
80+
owner: z.string().describe("Repository owner (username or organization)"),
81+
repo: z.string().describe("Repository name"),
82+
title: z.string().describe("Pull request title"),
83+
body: z.string().optional().describe("Pull request body/description"),
84+
head: z.string().describe("The name of the branch where your changes are implemented"),
85+
base: z.string().describe("The name of the branch you want the changes pulled into"),
86+
draft: z.boolean().optional().describe("Whether to create the pull request as a draft"),
87+
maintainer_can_modify: z.boolean().optional().describe("Whether maintainers can modify the pull request")
88+
});
89+
7990
export const GetPullRequestSchema = z.object({
8091
owner: z.string().describe("Repository owner (username or organization)"),
8192
repo: z.string().describe("Repository name"),
@@ -149,6 +160,22 @@ export const GetPullRequestReviewsSchema = z.object({
149160
});
150161

151162
// Function implementations
163+
export async function createPullRequest(
164+
params: z.infer<typeof CreatePullRequestSchema>
165+
): Promise<z.infer<typeof GitHubPullRequestSchema>> {
166+
const { owner, repo, ...options } = CreatePullRequestSchema.parse(params);
167+
168+
const response = await githubRequest(
169+
`https://api.github.com/repos/${owner}/${repo}/pulls`,
170+
{
171+
method: "POST",
172+
body: options,
173+
}
174+
);
175+
176+
return GitHubPullRequestSchema.parse(response);
177+
}
178+
152179
export async function getPullRequest(
153180
owner: string,
154181
repo: string,

0 commit comments

Comments
 (0)