@node-core/utils 5.0.2 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/git/v8.js +2 -0
- package/lib/ci/run_ci.js +1 -1
- package/lib/pr_checker.js +26 -0
- package/lib/pr_data.js +10 -0
- package/lib/queries/PRLabeledEvents.gql +19 -0
- package/lib/update-v8/majorUpdate.js +9 -4
- package/lib/update-v8/minorUpdate.js +5 -3
- package/lib/update-v8/updateV8Clone.js +2 -0
- package/package.json +15 -15
package/components/git/v8.js
CHANGED
@@ -81,6 +81,7 @@ export function handler(argv) {
|
|
81
81
|
options.execGitNode = function execGitNode(cmd, args, input) {
|
82
82
|
args.unshift(cmd);
|
83
83
|
return forceRunAsync('git', args, {
|
84
|
+
ignoreFailure: false,
|
84
85
|
input,
|
85
86
|
spawnArgs: {
|
86
87
|
cwd: options.nodeDir,
|
@@ -91,6 +92,7 @@ export function handler(argv) {
|
|
91
92
|
|
92
93
|
options.execGitV8 = function execGitV8(...args) {
|
93
94
|
return forceRunAsync('git', args, {
|
95
|
+
ignoreFailure: false,
|
94
96
|
captureStdout: true,
|
95
97
|
spawnArgs: { cwd: options.v8Dir, stdio: ['ignore', 'pipe', 'ignore'] }
|
96
98
|
});
|
package/lib/ci/run_ci.js
CHANGED
@@ -27,7 +27,7 @@ export class RunPRJob {
|
|
27
27
|
this.certifySafe =
|
28
28
|
certifySafe ||
|
29
29
|
Promise.all([this.prData.getReviews(), this.prData.getPR()]).then(() =>
|
30
|
-
new PRChecker(cli, this.prData, request, {}).
|
30
|
+
new PRChecker(cli, this.prData, request, {}).checkCommitsAfterReviewOrLabel()
|
31
31
|
);
|
32
32
|
}
|
33
33
|
|
package/lib/pr_checker.js
CHANGED
@@ -523,6 +523,32 @@ export default class PRChecker {
|
|
523
523
|
return true;
|
524
524
|
}
|
525
525
|
|
526
|
+
async checkCommitsAfterReviewOrLabel() {
|
527
|
+
if (this.checkCommitsAfterReview()) return true;
|
528
|
+
|
529
|
+
await Promise.all([this.data.getLabeledEvents(), this.data.getCollaborators()]);
|
530
|
+
|
531
|
+
const {
|
532
|
+
cli, data, pr
|
533
|
+
} = this;
|
534
|
+
|
535
|
+
const { updatedAt } = pr.timelineItems;
|
536
|
+
const requestCiLabels = data.labeledEvents.findLast(
|
537
|
+
({ createdAt, label: { name } }) => name === 'request-ci' && createdAt > updatedAt
|
538
|
+
);
|
539
|
+
if (requestCiLabels == null) return false;
|
540
|
+
|
541
|
+
const { actor: { login } } = requestCiLabels;
|
542
|
+
const collaborators = Array.from(data.collaborators.values(),
|
543
|
+
(c) => c.login.toLowerCase());
|
544
|
+
if (collaborators.includes(login.toLowerCase())) {
|
545
|
+
cli.info('request-ci label was added by a Collaborator after the last push event.');
|
546
|
+
return true;
|
547
|
+
}
|
548
|
+
|
549
|
+
return false;
|
550
|
+
}
|
551
|
+
|
526
552
|
checkCommitsAfterReview() {
|
527
553
|
const {
|
528
554
|
commits, reviews, cli, argv
|
package/lib/pr_data.js
CHANGED
@@ -5,6 +5,7 @@ import {
|
|
5
5
|
} from './user_status.js';
|
6
6
|
|
7
7
|
// lib/queries/*.gql file names
|
8
|
+
const LABELED_EVENTS_QUERY = 'PRLabeledEvents';
|
8
9
|
const PR_QUERY = 'PR';
|
9
10
|
const REVIEWS_QUERY = 'Reviews';
|
10
11
|
const COMMENTS_QUERY = 'PRComments';
|
@@ -33,6 +34,7 @@ export default class PRData {
|
|
33
34
|
this.comments = [];
|
34
35
|
this.commits = [];
|
35
36
|
this.reviewers = [];
|
37
|
+
this.labeledEvents = [];
|
36
38
|
}
|
37
39
|
|
38
40
|
getThread() {
|
@@ -90,6 +92,14 @@ export default class PRData {
|
|
90
92
|
]);
|
91
93
|
}
|
92
94
|
|
95
|
+
async getLabeledEvents() {
|
96
|
+
const { prid, owner, repo, cli, request, prStr } = this;
|
97
|
+
const vars = { prid, owner, repo };
|
98
|
+
cli.updateSpinner(`Getting labels from ${prStr}`);
|
99
|
+
this.labeledEvents = (await request.gql(LABELED_EVENTS_QUERY, vars))
|
100
|
+
.repository.pullRequest.timelineItems.nodes;
|
101
|
+
}
|
102
|
+
|
93
103
|
async getComments() {
|
94
104
|
const { prid, owner, repo, cli, request, prStr } = this;
|
95
105
|
const vars = { prid, owner, repo };
|
@@ -0,0 +1,19 @@
|
|
1
|
+
query PRLabeledEvents($prid: Int!, $owner: String!, $repo: String!, $after: String) {
|
2
|
+
repository(owner: $owner, name: $repo) {
|
3
|
+
pullRequest(number: $prid) {
|
4
|
+
timelineItems(itemTypes: LABELED_EVENT, after: $after, last: 100) {
|
5
|
+
nodes {
|
6
|
+
... on LabeledEvent {
|
7
|
+
actor {
|
8
|
+
login
|
9
|
+
}
|
10
|
+
label {
|
11
|
+
name
|
12
|
+
}
|
13
|
+
createdAt
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
@@ -14,7 +14,7 @@ import {
|
|
14
14
|
} from './util.js';
|
15
15
|
import applyNodeChanges from './applyNodeChanges.js';
|
16
16
|
import { chromiumGit, v8Deps } from './constants.js';
|
17
|
-
import {
|
17
|
+
import { forceRunAsync } from '../run.js';
|
18
18
|
|
19
19
|
export default function majorUpdate() {
|
20
20
|
return {
|
@@ -83,7 +83,8 @@ function cloneLocalV8() {
|
|
83
83
|
return {
|
84
84
|
title: 'Clone branch to deps/v8',
|
85
85
|
task: (ctx) =>
|
86
|
-
|
86
|
+
forceRunAsync('git', ['clone', '-b', ctx.branch, ctx.v8Dir, 'deps/v8'], {
|
87
|
+
ignoreFailure: false,
|
87
88
|
spawnArgs: { cwd: ctx.nodeDir, stdio: 'ignore' }
|
88
89
|
})
|
89
90
|
};
|
@@ -101,7 +102,8 @@ function addDepsV8() {
|
|
101
102
|
title: 'Track all files in deps/v8',
|
102
103
|
// Add all V8 files with --force before updating DEPS. We have to do this
|
103
104
|
// because some files are checked in by V8 despite .gitignore rules.
|
104
|
-
task: (ctx) =>
|
105
|
+
task: (ctx) => forceRunAsync('git', ['add', '--force', 'deps/v8'], {
|
106
|
+
ignoreFailure: false,
|
105
107
|
spawnArgs: { cwd: ctx.nodeDir, stdio: 'ignore' }
|
106
108
|
})
|
107
109
|
};
|
@@ -164,6 +166,9 @@ async function fetchFromGit(cwd, repo, commit) {
|
|
164
166
|
await removeDirectory(path.join(cwd, '.git'));
|
165
167
|
|
166
168
|
function exec(...options) {
|
167
|
-
return
|
169
|
+
return forceRunAsync('git', options, {
|
170
|
+
ignoreFailure: false,
|
171
|
+
spawnArgs: { cwd, stdio: 'ignore' }
|
172
|
+
});
|
168
173
|
}
|
169
174
|
}
|
@@ -6,7 +6,7 @@ import { Listr } from 'listr2';
|
|
6
6
|
|
7
7
|
import { getCurrentV8Version } from './common.js';
|
8
8
|
import { isVersionString } from './util.js';
|
9
|
-
import {
|
9
|
+
import { forceRunAsync } from '../run.js';
|
10
10
|
|
11
11
|
export default function minorUpdate() {
|
12
12
|
return {
|
@@ -27,7 +27,8 @@ function getLatestV8Version() {
|
|
27
27
|
task: async(ctx) => {
|
28
28
|
const version = ctx.currentVersion;
|
29
29
|
const currentV8Tag = `${version.major}.${version.minor}.${version.build}`;
|
30
|
-
const result = await
|
30
|
+
const result = await forceRunAsync('git', ['tag', '-l', `${currentV8Tag}.*`], {
|
31
|
+
ignoreFailure: false,
|
31
32
|
captureStdout: true,
|
32
33
|
spawnArgs: {
|
33
34
|
cwd: ctx.v8Dir,
|
@@ -68,7 +69,8 @@ async function applyPatch(ctx, latestStr) {
|
|
68
69
|
{ cwd: ctx.v8Dir, stdio: ['ignore', 'pipe', 'ignore'] }
|
69
70
|
);
|
70
71
|
try {
|
71
|
-
await
|
72
|
+
await forceRunAsync('git', ['apply', '--directory', 'deps/v8'], {
|
73
|
+
ignoreFailure: false,
|
72
74
|
spawnArgs: {
|
73
75
|
cwd: ctx.nodeDir,
|
74
76
|
stdio: [diff.stdout, 'ignore', 'ignore']
|
@@ -20,6 +20,7 @@ function fetchOrigin() {
|
|
20
20
|
task: async(ctx, task) => {
|
21
21
|
try {
|
22
22
|
await forceRunAsync('git', ['fetch', 'origin'], {
|
23
|
+
ignoreFailure: false,
|
23
24
|
spawnArgs: { cwd: ctx.v8Dir, stdio: 'ignore' }
|
24
25
|
});
|
25
26
|
} catch (e) {
|
@@ -40,6 +41,7 @@ function createClone() {
|
|
40
41
|
task: async(ctx) => {
|
41
42
|
await fs.mkdir(ctx.baseDir, { recursive: true });
|
42
43
|
await forceRunAsync('git', ['clone', v8Git, ctx.v8Dir], {
|
44
|
+
ignoreFailure: false,
|
43
45
|
spawnArgs: { stdio: 'ignore' }
|
44
46
|
});
|
45
47
|
},
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@node-core/utils",
|
3
|
-
"version": "5.0
|
3
|
+
"version": "5.1.0",
|
4
4
|
"description": "Utilities for Node.js core collaborators",
|
5
5
|
"type": "module",
|
6
6
|
"engines": {
|
@@ -34,36 +34,36 @@
|
|
34
34
|
],
|
35
35
|
"license": "MIT",
|
36
36
|
"dependencies": {
|
37
|
-
"@listr2/prompt-adapter-enquirer": "^2.0.
|
38
|
-
"@node-core/caritat": "^1.3.
|
37
|
+
"@listr2/prompt-adapter-enquirer": "^2.0.8",
|
38
|
+
"@node-core/caritat": "^1.3.1",
|
39
39
|
"@pkgjs/nv": "^0.2.2",
|
40
|
-
"branch-diff": "^3.0.
|
40
|
+
"branch-diff": "^3.0.4",
|
41
41
|
"chalk": "^5.3.0",
|
42
|
-
"changelog-maker": "^4.
|
42
|
+
"changelog-maker": "^4.1.1",
|
43
43
|
"cheerio": "^1.0.0-rc.12",
|
44
44
|
"clipboardy": "^4.0.0",
|
45
45
|
"core-validate-commit": "^4.0.0",
|
46
|
-
"figures": "^6.0
|
47
|
-
"ghauth": "^6.0.
|
48
|
-
"inquirer": "^9.2.
|
46
|
+
"figures": "^6.1.0",
|
47
|
+
"ghauth": "^6.0.4",
|
48
|
+
"inquirer": "^9.2.22",
|
49
49
|
"js-yaml": "^4.1.0",
|
50
|
-
"listr2": "^8.
|
50
|
+
"listr2": "^8.2.1",
|
51
51
|
"lodash": "^4.17.21",
|
52
52
|
"log-symbols": "^6.0.0",
|
53
53
|
"ora": "^8.0.1",
|
54
54
|
"replace-in-file": "^7.1.0",
|
55
|
-
"undici": "^6.
|
55
|
+
"undici": "^6.18.0",
|
56
56
|
"which": "^4.0.0",
|
57
57
|
"yargs": "^17.7.2"
|
58
58
|
},
|
59
59
|
"devDependencies": {
|
60
|
-
"@reporters/github": "^1.
|
61
|
-
"c8": "^9.
|
62
|
-
"eslint": "^8.
|
60
|
+
"@reporters/github": "^1.7.0",
|
61
|
+
"c8": "^9.1.0",
|
62
|
+
"eslint": "^8.57.0",
|
63
63
|
"eslint-config-standard": "^17.1.0",
|
64
64
|
"eslint-plugin-import": "^2.29.1",
|
65
|
-
"eslint-plugin-n": "^16.6.
|
65
|
+
"eslint-plugin-n": "^16.6.2",
|
66
66
|
"eslint-plugin-promise": "^6.1.1",
|
67
|
-
"sinon": "^
|
67
|
+
"sinon": "^18.0.0"
|
68
68
|
}
|
69
69
|
}
|