@@ -76,6 +76,17 @@ export const PullRequestReviewSchema = z.object({
76
76
} ) ;
77
77
78
78
// 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
+
79
90
export const GetPullRequestSchema = z . object ( {
80
91
owner : z . string ( ) . describe ( "Repository owner (username or organization)" ) ,
81
92
repo : z . string ( ) . describe ( "Repository name" ) ,
@@ -149,6 +160,22 @@ export const GetPullRequestReviewsSchema = z.object({
149
160
} ) ;
150
161
151
162
// 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
+
152
179
export async function getPullRequest (
153
180
owner : string ,
154
181
repo : string ,
0 commit comments