Skip to content

Commit de6cca7

Browse files
mscdexphillipj
authored andcommitted
labels: disregard meta labels in exclusive match (nodejs#151)
1 parent 1fd5a41 commit de6cca7

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

lib/node-labels.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ const exclusiveLabelsMap = new Map([
117117

118118
// specific map for modules.md as it should be labeled 'module' not 'modules'
119119
[/^doc\/api\/modules.md$/, ['doc', 'module']],
120-
// automatically tag JS subsystem-specific API doc changes
121-
[/^doc\/api\/(\w+)\.md$/, ['doc', '$1']],
122120
// n-api is treated separately since it is not a JS core module but is still
123121
// considered a subsystem of sorts
124122
[/^doc\/api\/n-api.md$/, ['doc', 'n-api', 'dont-land-on-v4.x', 'dont-land-on-v6.x']],
123+
// automatically tag JS subsystem-specific API doc changes
124+
[/^doc\/api\/(\w+)\.md$/, ['doc', '$1']],
125125

126126
[/^doc\//, 'doc'],
127127

@@ -183,13 +183,16 @@ function hasAllTestChanges (arr) {
183183
function matchExclusiveSubSystem (filepathsChanged) {
184184
const isExclusive = filepathsChanged.every(matchesAnExclusiveLabel)
185185
var labels = matchSubSystemsByRegex(exclusiveLabelsMap, filepathsChanged)
186+
var nonMetaLabels = labels.filter((label) => {
187+
return !/^dont\-/.test(label)
188+
})
186189

187190
// if there are multiple API doc changes, do not apply subsystem tags for now
188191
if (isExclusive &&
189-
labels.includes('doc') &&
190-
labels.length > 2 &&
192+
nonMetaLabels.includes('doc') &&
193+
nonMetaLabels.length > 2 &&
191194
!hasAllTestChanges(filepathsChanged)) {
192-
const nonDocLabels = labels.filter((val) => {
195+
const nonDocLabels = nonMetaLabels.filter((val) => {
193196
return val !== 'doc'
194197
})
195198
if (hasAllSubsystems(nonDocLabels) || hasAllDocChanges(filepathsChanged)) {

test/unit/node-labels.test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,12 @@ for (const info of specificTools) {
567567
[
568568
[ ['V8 Engine', 'post-mortem'],
569569
['deps/v8/tools/gen-postmortem-metadata.py'] ],
570-
[ ['c++', 'n-api'],
570+
[ ['c++', 'n-api', 'dont-land-on-v4.x', 'dont-land-on-v6.x'],
571571
['src/node_api.cc', 'src/node_api.h', 'src/node_api_types.h'] ],
572-
[ ['test', 'n-api'], ['test/addons-napi/foo'] ],
573-
[ ['doc', 'n-api'], ['doc/api/n-api.md'] ]
572+
[ ['test', 'n-api', 'dont-land-on-v4.x', 'dont-land-on-v6.x'],
573+
['test/addons-napi/foo'] ],
574+
[ ['doc', 'n-api', 'dont-land-on-v4.x', 'dont-land-on-v6.x'],
575+
['doc/api/n-api.md'] ]
574576
].forEach((info) => {
575577
const labels = info[0]
576578
const files = info[1]

0 commit comments

Comments
 (0)