11'use strict'
22
3+ const ciNeededFolderRx = / ^ ( d e p s | l i b | s r c | t e s t ) \/ /
34// order of entries in this map *does* matter for the resolved labels
45// earlier entries override later entries
56const subSystemLabelsMap = new Map ( [
@@ -37,10 +38,10 @@ const subSystemLabelsMap = new Map([
3738 [ / ^ s r c \/ n o d e _ b o b * / , [ 'c++' , 'quic' , 'dont-land-on-v14.x' , 'dont-land-on-v12.x' ] ] ,
3839
3940 // don't label python files as c++
40- [ / ^ s r c \/ .+ \. p y $ / , 'lib / src' ] ,
41+ [ / ^ s r c \/ .+ \. p y $ / , [ 'lib / src' , 'needs-ci' ] ] ,
4142
4243 // properly label changes to v8 inspector integration-related files
43- [ / ^ s r c \/ i n s p e c t o r _ / , [ 'c++' , 'inspector' ] ] ,
44+ [ / ^ s r c \/ i n s p e c t o r _ / , [ 'c++' , 'inspector' , 'needs-ci' ] ] ,
4445
4546 // don't want to label it a c++ update when we're "only" bumping the Node.js version
4647 [ / ^ s r c \/ (? ! n o d e _ v e r s i o n \. h ) / , 'c++' ] ,
@@ -51,22 +52,24 @@ const subSystemLabelsMap = new Map([
5152 // things that edit top-level .md files are always a doc change
5253 [ / ^ \w + \. m d $ / , 'doc' ] ,
5354 // different variants of *Makefile and build files
54- [ / ^ ( t o o l s \/ ) ? ( M a k e f i l e | B S D m a k e f i l e | c r e a t e _ a n d r o i d _ m a k e f i l e s | \. t r a v i s \. y m l ) $ / , 'build' ] ,
55- [ / ^ t o o l s \/ ( i n s t a l l \. p y | g e n v 8 c o n s t a n t s \. p y | g e t n o d e v e r s i o n \. p y | j s 2 c \. p y | u t i l s \. p y | c o n f i g u r e \. d \/ .* ) $ / , 'build' ] ,
56- [ / ^ v c b u i l d \. b a t $ / , [ 'build' , 'windows' ] ] ,
57- [ / ^ ( a n d r o i d - ) ? c o n f i g u r e | n o d e \. g y p | c o m m o n \. g y p i $ / , 'build' ] ,
55+ [ / ^ ( t o o l s \/ ) ? ( M a k e f i l e | B S D m a k e f i l e | c r e a t e _ a n d r o i d _ m a k e f i l e s | \. t r a v i s \. y m l ) $ / , [ 'build' , 'needs-ci' ] ] ,
56+ [ / ^ t o o l s \/ ( i n s t a l l \. p y | g e n v 8 c o n s t a n t s \. p y | g e t n o d e v e r s i o n \. p y | j s 2 c \. p y | u t i l s \. p y | c o n f i g u r e \. d \/ .* ) $ / , [ 'build' , 'needs-ci' ] ] ,
57+ [ / ^ v c b u i l d \. b a t $ / , [ 'build' , 'windows' , 'needs-ci' ] ] ,
58+ [ / ^ ( a n d r o i d - ) ? c o n f i g u r e | n o d e \. g y p | c o m m o n \. g y p i $ / , [ 'build' , 'needs-ci' ] ] ,
5859 // more specific tools
59- [ / ^ t o o l s \/ g y p / , [ 'tools' , 'build' ] ] ,
60+ [ / ^ t o o l s \/ g y p / , [ 'tools' , 'build' , 'needs-ci' ] ] ,
6061 [ / ^ t o o l s \/ d o c \/ / , [ 'tools' , 'doc' ] ] ,
61- [ / ^ t o o l s \/ i c u \/ / , [ 'tools' , 'intl' ] ] ,
62+ [ / ^ t o o l s \/ i c u \/ / , [ 'tools' , 'intl' , 'needs-ci' ] ] ,
6263 [ / ^ t o o l s \/ (?: o s x - p k g \. p m d o c | p k g s r c ) \/ / , [ 'tools' , 'macos' , 'install' ] ] ,
6364 [ / ^ t o o l s \/ (?: (?: m a c ) ? o s x - ) / , [ 'tools' , 'macos' ] ] ,
6465 [ / ^ t o o l s \/ t e s t - n p m / , [ 'tools' , 'test' , 'npm' ] ] ,
6566 [ / ^ t o o l s \/ t e s t / , [ 'tools' , 'test' ] ] ,
6667 [ / ^ t o o l s \/ (?: c e r t d a t a | m k s s l d e f | m k - c a - b u n d l e ) / , [ 'tools' , 'openssl' , 'tls' ] ] ,
67- [ / ^ t o o l s \/ m s v s \/ / , [ 'tools' , 'windows' , 'install' ] ] ,
68- [ / ^ t o o l s \/ [ ^ / ] + \. b a t $ / , [ 'tools' , 'windows' ] ] ,
69- [ / ^ t o o l s \/ m a k e - v 8 / , [ 'tools' , 'V8 Engine' ] ] ,
68+ [ / ^ t o o l s \/ m s v s \/ / , [ 'tools' , 'windows' , 'install' , 'needs-ci' ] ] ,
69+ [ / ^ t o o l s \/ [ ^ / ] + \. b a t $ / , [ 'tools' , 'windows' , 'needs-ci' ] ] ,
70+ [ / ^ t o o l s \/ m a k e - v 8 / , [ 'tools' , 'V8 Engine' , 'needs-ci' ] ] ,
71+ [ / ^ t o o l s \/ ( c o d e _ c a c h e | s n a p s h o t | v 8 _ g y p f i l e s ) / , 'needs-ci' ] ,
72+ [ / ^ t o o l s \/ b u i l d - a d d o n s .j s / , 'needs-ci' ] ,
7073 // all other tool changes should be marked as such
7174 [ / ^ t o o l s \/ / , 'tools' ] ,
7275 [ / ^ \. e s l i n t | \. r e m a r k | \. e d i t o r c o n f i g / , 'tools' ] ,
@@ -239,6 +242,10 @@ function matchSubSystemsByRegex (rxLabelsMap, filepathsChanged, limitLabels) {
239242 const labelCount = [ ]
240243 // by putting matched labels into a map, we avoid duplicate labels
241244 const labelsMap = filepathsChanged . reduce ( ( map , filepath ) => {
245+ if ( ciNeededFolderRx . test ( filepath ) && ! map [ 'needs-ci' ] ) {
246+ map [ 'needs-ci' ] = true
247+ }
248+
242249 const mappedSubSystems = mappedSubSystemsForFile ( rxLabelsMap , filepath )
243250
244251 if ( ! mappedSubSystems ) {
@@ -251,8 +258,8 @@ function matchSubSystemsByRegex (rxLabelsMap, filepathsChanged, limitLabels) {
251258 if ( limitLabels && hasLibOrSrcChanges ( filepathsChanged ) ) {
252259 if ( labelCount . length >= 4 ) {
253260 for ( const label of labelCount ) {
254- // don't delete the c++ label as we always want that if it has matched
255- if ( label !== 'c++' ) delete map [ label ]
261+ // don't delete the ` c++` or `needs-ci` labels as we always want those if they have matched
262+ if ( label !== 'c++' && label !== 'needs-ci' ) delete map [ label ]
256263 }
257264 map [ 'lib / src' ] = true
258265 // short-circuit
0 commit comments