@@ -6,7 +6,7 @@ import TeamInfo from '../../lib/team_info.js';
6
6
import Request from '../../lib/request.js' ;
7
7
import { runPromise } from '../../lib/run.js' ;
8
8
9
- export const command = 'release [prid|options ]' ;
9
+ export const command = 'release [prid.. ]' ;
10
10
export const describe = 'Manage an in-progress release or start a new one.' ;
11
11
12
12
const PREPARE = 'prepare' ;
@@ -34,8 +34,13 @@ const releaseOptions = {
34
34
describe : 'Promote new release of Node.js' ,
35
35
type : 'boolean'
36
36
} ,
37
+ fetchFrom : {
38
+ describe : 'Remote to fetch the release proposal(s) from, if different from the one where to' +
39
+ 'push the tags and commits.' ,
40
+ type : 'string' ,
41
+ } ,
37
42
releaseDate : {
38
- describe : 'Default relase date when --prepare is used. It must be YYYY-MM-DD' ,
43
+ describe : 'Default release date when --prepare is used. It must be YYYY-MM-DD' ,
39
44
type : 'string'
40
45
} ,
41
46
run : {
@@ -112,11 +117,6 @@ function release(state, argv) {
112
117
}
113
118
114
119
async function main ( state , argv , cli , dir ) {
115
- const prID = / ^ (?: h t t p s : \/ \/ g i t h u b \. c o m \/ n o d e j s ( - p r i v a t e ) ? \/ n o d e \1\/ p u l l \/ ) ? ( \d + ) $ / . exec ( argv . prid ) ;
116
- if ( prID ) {
117
- if ( prID [ 1 ] ) argv . security = true ;
118
- argv . prid = Number ( prID [ 2 ] ) ;
119
- }
120
120
if ( state === PREPARE ) {
121
121
const release = new ReleasePreparation ( argv , cli , dir ) ;
122
122
@@ -160,6 +160,24 @@ async function main(state, argv, cli, dir) {
160
160
cli . stopSpinner ( `${ release . username } is a Releaser` ) ;
161
161
}
162
162
163
- return release . promote ( ) ;
163
+ const releases = [ ] ;
164
+ for ( const pr of argv . prid ) {
165
+ const match = / ^ (?: h t t p s : \/ \/ g i t h u b \. c o m \/ ( [ ^ / ] + ) \/ ( [ ^ / ] + ) \/ p u l l \/ ) ? ( \d + ) (?: # .* ) ? $ / . exec ( pr ) ;
166
+ if ( ! match ) throw new Error ( 'Invalid PR ID or URL' , { cause : pr } ) ;
167
+ const [ , owner , repo , prid ] = match ;
168
+
169
+ if (
170
+ owner &&
171
+ ( owner !== release . owner || repo !== release . repo ) &&
172
+ ! argv . fetchFrom
173
+ ) {
174
+ console . warn ( 'The configured owner/repo does not match the PR URL.' ) ;
175
+ console . info ( 'You should either pass `--fetch-from` flag or check your configuration' ) ;
176
+ console . info ( `E.g. [email protected] :${ owner } /${ repo } .git` ) ;
177
+ throw new Error ( 'You need to tell what remote use to fetch security release proposal.' ) ;
178
+ }
179
+ releases . push ( await release . preparePromotion ( { owner, repo, prid : Number ( prid ) } ) ) ;
180
+ }
181
+ return release . promote ( releases ) ;
164
182
}
165
183
}
0 commit comments