fix: Add missing CreatePullRequestSchema and createPullRequest function
This commit is contained in:
parent
a12c6ff23d
commit
de256a48b1
1 changed files with 27 additions and 0 deletions
|
|
@ -76,6 +76,17 @@ export const PullRequestReviewSchema = z.object({
|
||||||
});
|
});
|
||||||
|
|
||||||
// Input schemas
|
// Input schemas
|
||||||
|
export const CreatePullRequestSchema = z.object({
|
||||||
|
owner: z.string().describe("Repository owner (username or organization)"),
|
||||||
|
repo: z.string().describe("Repository name"),
|
||||||
|
title: z.string().describe("Pull request title"),
|
||||||
|
body: z.string().optional().describe("Pull request body/description"),
|
||||||
|
head: z.string().describe("The name of the branch where your changes are implemented"),
|
||||||
|
base: z.string().describe("The name of the branch you want the changes pulled into"),
|
||||||
|
draft: z.boolean().optional().describe("Whether to create the pull request as a draft"),
|
||||||
|
maintainer_can_modify: z.boolean().optional().describe("Whether maintainers can modify the pull request")
|
||||||
|
});
|
||||||
|
|
||||||
export const GetPullRequestSchema = z.object({
|
export const GetPullRequestSchema = z.object({
|
||||||
owner: z.string().describe("Repository owner (username or organization)"),
|
owner: z.string().describe("Repository owner (username or organization)"),
|
||||||
repo: z.string().describe("Repository name"),
|
repo: z.string().describe("Repository name"),
|
||||||
|
|
@ -149,6 +160,22 @@ export const GetPullRequestReviewsSchema = z.object({
|
||||||
});
|
});
|
||||||
|
|
||||||
// Function implementations
|
// Function implementations
|
||||||
|
export async function createPullRequest(
|
||||||
|
params: z.infer<typeof CreatePullRequestSchema>
|
||||||
|
): Promise<z.infer<typeof GitHubPullRequestSchema>> {
|
||||||
|
const { owner, repo, ...options } = CreatePullRequestSchema.parse(params);
|
||||||
|
|
||||||
|
const response = await githubRequest(
|
||||||
|
`https://api.github.com/repos/${owner}/${repo}/pulls`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
body: options,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return GitHubPullRequestSchema.parse(response);
|
||||||
|
}
|
||||||
|
|
||||||
export async function getPullRequest(
|
export async function getPullRequest(
|
||||||
owner: string,
|
owner: string,
|
||||||
repo: string,
|
repo: string,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue