@@ -61,7 +61,7 @@ export class PullRequestFlow extends InBranchFlow {
6161 private async ensureFreshPr ( i18nBranchName : string ) {
6262 // Check if PR exists
6363 this . ora . start (
64- `Checking for existing PR with head ${ i18nBranchName } and base ${ this . platformKit . platformConfig . baseBranchName } ` ,
64+ `Checking for existing PR with head ${ i18nBranchName } and base ${ this . platformKit . platformConfig . baseBranchName } `
6565 ) ;
6666 const existingPrNumber = await this . platformKit . getOpenPullRequestNumber ( {
6767 branch : i18nBranchName ,
@@ -91,7 +91,9 @@ export class PullRequestFlow extends InBranchFlow {
9191 this . ora . start ( `Posting comment about outdated PR ${ existingPrNumber } ` ) ;
9292 await this . platformKit . commentOnPullRequest ( {
9393 pullRequestNumber : existingPrNumber ,
94- body : `This PR is now outdated. A new version has been created at ${ this . platformKit . buildPullRequestUrl ( newPrNumber ) } ` ,
94+ body : `This PR is now outdated. A new version has been created at ${ this . platformKit . buildPullRequestUrl (
95+ newPrNumber
96+ ) } `,
9597 } ) ;
9698 this . ora . succeed ( `Posted comment about outdated PR ${ existingPrNumber } ` ) ;
9799 }
@@ -107,10 +109,22 @@ export class PullRequestFlow extends InBranchFlow {
107109 }
108110
109111 private createI18nBranch ( i18nBranchName : string ) {
110- execSync ( `git fetch origin ${ this . platformKit . platformConfig . baseBranchName } ` , { stdio : "inherit" } ) ;
111- execSync ( `git checkout -b ${ i18nBranchName } origin/${ this . platformKit . platformConfig . baseBranchName } ` , {
112- stdio : "inherit" ,
113- } ) ;
112+ try {
113+ execSync ( `git fetch origin ${ this . platformKit . platformConfig . baseBranchName } ` , { stdio : "inherit" } ) ;
114+ execSync ( `git checkout -b ${ i18nBranchName } origin/${ this . platformKit . platformConfig . baseBranchName } ` , {
115+ stdio : "inherit" ,
116+ } ) ;
117+ } catch ( error ) {
118+ const errorMessage = error instanceof Error ? error . message : "Unknown error occurred" ;
119+ this . ora . fail ( `Failed to create branch: ${ errorMessage } ` ) ;
120+ this . ora . info ( `
121+ Troubleshooting tips:
122+ 1. Make sure you have permission to create branches
123+ 2. Check if the branch already exists locally (try 'git branch -a')
124+ 3. Verify connectivity to remote repository
125+ ` ) ;
126+ throw new Error ( `Branch creation failed: ${ errorMessage } ` ) ;
127+ }
114128 }
115129
116130 private syncI18nBranch ( ) {
@@ -141,7 +155,7 @@ export class PullRequestFlow extends InBranchFlow {
141155 const targetFiles = [ "i18n.lock" ] ;
142156 const targetFileNames = execSync (
143157 `npx lingo.dev@latest show files --target ${ this . platformKit . platformConfig . baseBranchName } ` ,
144- { encoding : "utf8" } ,
158+ { encoding : "utf8" }
145159 )
146160 . split ( "\n" )
147161 . filter ( Boolean ) ;
0 commit comments