Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions lib/node-labels.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ const exclusiveLabelsMap = new Map([

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

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

Expand Down Expand Up @@ -183,13 +183,16 @@ function hasAllTestChanges (arr) {
function matchExclusiveSubSystem (filepathsChanged) {
const isExclusive = filepathsChanged.every(matchesAnExclusiveLabel)
var labels = matchSubSystemsByRegex(exclusiveLabelsMap, filepathsChanged)
var nonMetaLabels = labels.filter((label) => {
return !/^dont\-/.test(label)
})

// if there are multiple API doc changes, do not apply subsystem tags for now
if (isExclusive &&
labels.includes('doc') &&
labels.length > 2 &&
nonMetaLabels.includes('doc') &&
nonMetaLabels.length > 2 &&
!hasAllTestChanges(filepathsChanged)) {
const nonDocLabels = labels.filter((val) => {
const nonDocLabels = nonMetaLabels.filter((val) => {
return val !== 'doc'
})
if (hasAllSubsystems(nonDocLabels) || hasAllDocChanges(filepathsChanged)) {
Expand Down
8 changes: 5 additions & 3 deletions test/unit/node-labels.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,12 @@ for (const info of specificTools) {
[
[ ['V8 Engine', 'post-mortem'],
['deps/v8/tools/gen-postmortem-metadata.py'] ],
[ ['c++', 'n-api'],
[ ['c++', 'n-api', 'dont-land-on-v4.x', 'dont-land-on-v6.x'],
['src/node_api.cc', 'src/node_api.h', 'src/node_api_types.h'] ],
[ ['test', 'n-api'], ['test/addons-napi/foo'] ],
[ ['doc', 'n-api'], ['doc/api/n-api.md'] ]
[ ['test', 'n-api', 'dont-land-on-v4.x', 'dont-land-on-v6.x'],
['test/addons-napi/foo'] ],
[ ['doc', 'n-api', 'dont-land-on-v4.x', 'dont-land-on-v6.x'],
['doc/api/n-api.md'] ]
].forEach((info) => {
const labels = info[0]
const files = info[1]
Expand Down