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
38 changes: 28 additions & 10 deletions lib/pr_checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,8 @@ class PRChecker {
return true;
}

isOnlyDocChanges() {
const { cli, pr } = this;
requiresJenkinsRun() {
const { pr } = this;

// NOTE(mmarchini): if files not present, fallback
// to old behavior. This should only be the case on old tests
Expand All @@ -407,19 +407,37 @@ class PRChecker {
return false;
}

for (const { path } of pr.files.nodes) {
if (!path.endsWith('.md')) {
return false;
}
}
cli.info('Doc-only changes');
return true;
const ciNeededFolderRx = /^(deps|lib|src|test)\//;
const ciNeededToolFolderRx =
/^tools\/(code_cache|gyp|icu|inspector|msvs|snapshot|v8_gypfiles)/;
const ciNeededFileRx = /^tools\/\.+.py$/;
const ciNeededFileList = [
'tools/build-addons.js',
'configure',
'configure.py',
'Makefile'
];
const ciNeededExtensionList = ['.gyp', '.gypi', '.bat'];

return pr.files.nodes.some(
({ path }) =>
ciNeededFolderRx.test(path) ||
ciNeededToolFolderRx.test(path) ||
ciNeededFileRx.test(path) ||
ciNeededFileList.includes(path) ||
ciNeededExtensionList.some((ext) => path.endsWith(ext))
);
}

async checkNodejsCI() {
let status = this.checkActionsCI();
if (!this.isOnlyDocChanges()) {
if (
this.pr.labels.nodes.some((l) => l.name === 'needs-ci') ||
this.requiresJenkinsRun()
) {
status &= await this.checkJenkinsCI();
} else {
this.cli.info('Green GitHub Actions CI is sufficient');
}
return status;
}
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/first_timer_pr.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"bodyText": "Awesome changes",
"labels": {
"nodes": [
{
"name": "needs-ci"
},
{
"name": "test"
},
Expand Down
6 changes: 3 additions & 3 deletions test/unit/pr_checker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ describe('PRChecker', () => {
['No GitHub CI runs detected']
],
info: [
['Doc-only changes']
['Green GitHub Actions CI is sufficient']
]
};

Expand Down Expand Up @@ -697,7 +697,7 @@ describe('PRChecker', () => {
['Last GitHub Actions successful']
],
info: [
['Doc-only changes']
['Green GitHub Actions CI is sufficient']
]
};

Expand Down Expand Up @@ -741,7 +741,7 @@ describe('PRChecker', () => {
['Last GitHub Actions successful']
],
info: [
['Doc-only changes']
['Green GitHub Actions CI is sufficient']
]
};

Expand Down
2 changes: 1 addition & 1 deletion test/unit/pr_summary.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('PRSummary', () => {
'Their Github Account email <pr_author@example.com>' +
' (@pr_author, first-time contributor)'],
['Branch', 'pr_author:awesome-changes -> nodejs:master'],
['Labels', 'test, doc'],
['Labels', 'needs-ci, test, doc'],
['Commits', '6'],
['Committers', '3']
]
Expand Down