@@ -66,6 +66,7 @@ const backportOnce = async ({
66
66
owner,
67
67
repo,
68
68
title,
69
+ pullRequestNumber
69
70
} : {
70
71
base : string ;
71
72
body : string ;
@@ -77,12 +78,14 @@ const backportOnce = async ({
77
78
owner : string ;
78
79
repo : string ;
79
80
title : string ;
81
+ pullRequestNumber : number ;
80
82
} ) => {
81
83
const git = async ( ...args : string [ ] ) => {
82
84
await exec ( "git" , args , { cwd : repo } ) ;
83
85
} ;
84
86
85
87
let backportError = null ;
88
+ await git ( "fetch" , "origin" , `pull/${ pullRequestNumber } /head` ) ;
86
89
await git ( "switch" , base ) ;
87
90
await git ( "switch" , "--create" , head ) ;
88
91
@@ -111,7 +114,7 @@ const backportOnce = async ({
111
114
112
115
await git ( "push" , "--set-upstream" , "origin" , head ) ;
113
116
const {
114
- data : { number : pullRequestNumber } ,
117
+ data : { number : backportPullRequestNumber } ,
115
118
} = await github . pulls . create ( {
116
119
base,
117
120
body,
@@ -122,7 +125,7 @@ const backportOnce = async ({
122
125
} ) ;
123
126
if ( labelsToAdd . length > 0 ) {
124
127
await github . issues . addLabels ( {
125
- issue_number : pullRequestNumber ,
128
+ issue_number : backportPullRequestNumber ,
126
129
labels : labelsToAdd ,
127
130
owner,
128
131
repo,
@@ -269,6 +272,7 @@ const backport = async ({
269
272
owner,
270
273
repo,
271
274
title,
275
+ pullRequestNumber
272
276
} ) ;
273
277
} catch ( error : unknown ) {
274
278
if ( ! ( error instanceof Error ) ) {
0 commit comments