@@ -42,7 +42,12 @@ export function createPullRequest(
4242 prTitle : string ,
4343 prBody : string ,
4444 dryRun : boolean = false
45- ) : { success : boolean ; prNumber ?: number ; prUrl ?: string ; alreadyExists ?: boolean } {
45+ ) : {
46+ success : boolean ;
47+ prNumber ?: number ;
48+ prUrl ?: string ;
49+ alreadyExists ?: boolean ;
50+ } {
4651 try {
4752 // If in dry run mode, just log what would happen and return success
4853 if ( dryRun ) {
@@ -70,9 +75,9 @@ export function createPullRequest(
7075 cwd : tempDir ,
7176 encoding : "utf8" ,
7277 } ) ;
73-
78+
7479 const prList = JSON . parse ( prListOutput ) ;
75-
80+
7681 if ( prList . length > 0 ) {
7782 // PR already exists
7883 const existingPr = prList [ 0 ] ;
@@ -86,7 +91,9 @@ export function createPullRequest(
8691 }
8792 } catch ( checkError ) {
8893 // Ignore errors checking for existing PRs
89- logger . warn ( `Error checking for existing PRs: ${ ( checkError as Error ) . message } ` ) ;
94+ logger . warn (
95+ `Error checking for existing PRs: ${ ( checkError as Error ) . message } `
96+ ) ;
9097 }
9198
9299 // Create PR using GitHub CLI
@@ -122,11 +129,13 @@ export function createPullRequest(
122129 const errorMessage = ( prError as Error ) . message ;
123130 if ( errorMessage . includes ( "already exists" ) ) {
124131 // Extract the PR URL from the error message
125- const urlMatch = errorMessage . match ( / h t t p s : \/ \/ g i t h u b \. c o m \/ [ ^ \/ ] + \/ [ ^ \/ ] + \/ p u l l \/ \d + / ) ;
132+ const urlMatch = errorMessage . match (
133+ / h t t p s : \/ \/ g i t h u b \. c o m \/ [ ^ / ] + \/ [ ^ / ] + \/ p u l l \/ \d + /
134+ ) ;
126135 if ( urlMatch ) {
127136 const prUrl = urlMatch [ 0 ] ;
128137 const prNumber = prUrl . split ( "/" ) . pop ( ) ;
129-
138+
130139 logger . info ( `Pull request already exists: ${ prUrl } ` ) ;
131140 return {
132141 success : true ,
@@ -136,7 +145,7 @@ export function createPullRequest(
136145 } ;
137146 }
138147 }
139-
148+
140149 // Re-throw if we couldn't handle the error
141150 throw prError ;
142151 }
0 commit comments