@@ -63,42 +63,24 @@ export class PullRequestFlow extends InBranchFlow {
6363 this . ora . start (
6464 `Checking for existing PR with head ${ i18nBranchName } and base ${ this . platformKit . platformConfig . baseBranchName } `
6565 ) ;
66- const existingPrNumber = await this . platformKit . getOpenPullRequestNumber ( {
66+ let prNumber = await this . platformKit . getOpenPullRequestNumber ( {
6767 branch : i18nBranchName ,
6868 } ) ;
69- this . ora . succeed ( existingPrNumber ? "PR found" : "No PR found" ) ;
7069
71- if ( existingPrNumber ) {
72- // Close existing PR first
73- this . ora . start ( `Closing existing PR ${ existingPrNumber } ` ) ;
74- await this . platformKit . closePullRequest ( {
75- pullRequestNumber : existingPrNumber ,
76- } ) ;
77- this . ora . succeed ( `Closed existing PR ${ existingPrNumber } ` ) ;
78- }
79-
80- // Create new PR
81- this . ora . start ( `Creating new PR` ) ;
82- const newPrNumber = await this . platformKit . createPullRequest ( {
83- head : i18nBranchName ,
84- title : this . platformKit . config . pullRequestTitle ,
85- body : this . getPrBodyContent ( ) ,
86- } ) ;
87- this . ora . succeed ( `Created new PR ${ newPrNumber } ` ) ;
88-
89- if ( existingPrNumber ) {
90- // Post comment about outdated PR
91- this . ora . start ( `Posting comment about outdated PR ${ existingPrNumber } ` ) ;
92- await this . platformKit . commentOnPullRequest ( {
93- pullRequestNumber : existingPrNumber ,
94- body : `This PR is now outdated. A new version has been created at ${ this . platformKit . buildPullRequestUrl (
95- newPrNumber
96- ) } `,
70+ if ( prNumber ) {
71+ this . ora . succeed ( `Existing PR found: #${ prNumber } ` ) ;
72+ } else {
73+ // Create new PR
74+ this . ora . start ( `Creating new PR` ) ;
75+ prNumber = await this . platformKit . createPullRequest ( {
76+ head : i18nBranchName ,
77+ title : this . platformKit . config . pullRequestTitle ,
78+ body : this . getPrBodyContent ( ) ,
9779 } ) ;
98- this . ora . succeed ( `Posted comment about outdated PR ${ existingPrNumber } ` ) ;
80+ this . ora . succeed ( `Created new PR: # ${ prNumber } ` ) ;
9981 }
10082
101- return newPrNumber ;
83+ return prNumber ;
10284 }
10385
10486 private checkoutI18nBranch ( i18nBranchName : string ) {
0 commit comments