pr-report-core 0.0.6 → 0.2.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/dist/checks.d.mts.map +1 -1
- package/dist/checks.mjs +8 -8
- package/dist/checks.mjs.map +1 -1
- package/dist/code-owners.d.mts +24 -24
- package/dist/code-owners.d.mts.map +1 -1
- package/dist/code-owners.mjs +42 -42
- package/dist/code-owners.mjs.map +1 -1
- package/dist/labels.d.mts +18 -0
- package/dist/labels.d.mts.map +1 -1
- package/dist/labels.mjs +18 -0
- package/dist/labels.mjs.map +1 -1
- package/dist/merge-after.d.mts.map +1 -1
- package/dist/merge-after.mjs +13 -13
- package/dist/merge-after.mjs.map +1 -1
- package/dist/queue-order.d.mts +14 -1
- package/dist/queue-order.d.mts.map +1 -1
- package/dist/queue-order.mjs +34 -17
- package/dist/queue-order.mjs.map +1 -1
- package/dist/queue-owner.d.mts +17 -17
- package/dist/queue-owner.d.mts.map +1 -1
- package/dist/queue-owner.mjs +51 -51
- package/dist/queue-owner.mjs.map +1 -1
- package/dist/report.d.mts +5 -5
- package/dist/report.d.mts.map +1 -1
- package/dist/report.mjs +24 -24
- package/dist/report.mjs.map +1 -1
- package/dist/start-after.d.mts +32 -7
- package/dist/start-after.d.mts.map +1 -1
- package/dist/start-after.mjs +20 -1
- package/dist/start-after.mjs.map +1 -1
- package/package.json +5 -5
- package/src/checks.mts +10 -10
- package/src/code-owners.mts +81 -81
- package/src/labels.mts +20 -0
- package/src/merge-after.mts +23 -23
- package/src/queue-order.mts +49 -27
- package/src/queue-order.test.mts +37 -0
- package/src/queue-owner.mts +84 -84
- package/src/report.mts +44 -43
- package/src/report.test.mts +40 -0
- package/src/start-after.mts +47 -8
- package/src/start-after.test.mts +54 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue-owner.d.mts","sourceRoot":"","sources":["../src/queue-owner.mts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;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GAAG,SAAS,CAAC;IACtC,wDAAwD;IACxD,KAAK,EAAE,YAAY,GAAG,SAAS,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC"}
|
package/dist/queue-owner.mjs
CHANGED
|
@@ -43,56 +43,6 @@ export const SET_ASIDE_REASONS = [
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const setAsideOwner = (reason) => {
|
|
51
|
-
switch (reason) {
|
|
52
|
-
case 'checks-failed':
|
|
53
|
-
case 'rebase-failed':
|
|
54
|
-
return { owner: 'skill', why: 'the skill fixes it' };
|
|
55
|
-
case 'already-in-base':
|
|
56
|
-
return {
|
|
57
|
-
owner: 'human',
|
|
58
|
-
why: 'every commit is already in the base; close it',
|
|
59
|
-
};
|
|
60
|
-
case 'arm-failed':
|
|
61
|
-
return {
|
|
62
|
-
owner: 'human',
|
|
63
|
-
why: 'auto-merge could not be armed; a setting or a permission holds it',
|
|
64
|
-
};
|
|
65
|
-
case 'awaiting-bypass':
|
|
66
|
-
return {
|
|
67
|
-
owner: 'human',
|
|
68
|
-
why: 'green, and only a ruleset bypass merges it',
|
|
69
|
-
};
|
|
70
|
-
case 'not-merging':
|
|
71
|
-
return {
|
|
72
|
-
owner: 'human',
|
|
73
|
-
why: 'green but not merging; something the worker cannot read holds it',
|
|
74
|
-
};
|
|
75
|
-
case 'push-failed':
|
|
76
|
-
return {
|
|
77
|
-
owner: 'human',
|
|
78
|
-
why: 'the push was refused; a setting or a permission holds it',
|
|
79
|
-
};
|
|
80
|
-
case 'unlabel-failed':
|
|
81
|
-
return {
|
|
82
|
-
owner: 'human',
|
|
83
|
-
why: '`skip-ci` could not be taken off; a permission holds it',
|
|
84
|
-
};
|
|
85
|
-
case 'watch-timeout':
|
|
86
|
-
return {
|
|
87
|
-
owner: 'human',
|
|
88
|
-
why: 'its checks ran past the watch; look at the run',
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
46
|
export const queueOwner = (pr) => {
|
|
97
47
|
const queued = pr.labels.includes(MERGE_QUEUED_LABEL);
|
|
98
48
|
if (!queued &&
|
|
@@ -164,6 +114,57 @@ export const queueOwnerOfEntry = (entry, comments, context) => queueOwner({
|
|
|
164
114
|
claim: comments.claim?.says,
|
|
165
115
|
nowEpochMs: context.nowEpochMs,
|
|
166
116
|
});
|
|
117
|
+
export const isSetAsideReason = (reason) => KNOWN_REASONS.has(reason);
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
const setAsideOwner = (reason) => {
|
|
127
|
+
switch (reason) {
|
|
128
|
+
case 'checks-failed':
|
|
129
|
+
case 'rebase-failed':
|
|
130
|
+
return { owner: 'skill', why: 'the skill fixes it' };
|
|
131
|
+
case 'already-in-base':
|
|
132
|
+
return {
|
|
133
|
+
owner: 'human',
|
|
134
|
+
why: 'every commit is already in the base; close it',
|
|
135
|
+
};
|
|
136
|
+
case 'arm-failed':
|
|
137
|
+
return {
|
|
138
|
+
owner: 'human',
|
|
139
|
+
why: 'auto-merge could not be armed; a setting or a permission holds it',
|
|
140
|
+
};
|
|
141
|
+
case 'awaiting-bypass':
|
|
142
|
+
return {
|
|
143
|
+
owner: 'human',
|
|
144
|
+
why: 'green, and only a ruleset bypass merges it',
|
|
145
|
+
};
|
|
146
|
+
case 'not-merging':
|
|
147
|
+
return {
|
|
148
|
+
owner: 'human',
|
|
149
|
+
why: 'green but not merging; something the worker cannot read holds it',
|
|
150
|
+
};
|
|
151
|
+
case 'push-failed':
|
|
152
|
+
return {
|
|
153
|
+
owner: 'human',
|
|
154
|
+
why: 'the push was refused; a setting or a permission holds it',
|
|
155
|
+
};
|
|
156
|
+
case 'unlabel-failed':
|
|
157
|
+
return {
|
|
158
|
+
owner: 'human',
|
|
159
|
+
why: '`skip-ci` could not be taken off; a permission holds it',
|
|
160
|
+
};
|
|
161
|
+
case 'watch-timeout':
|
|
162
|
+
return {
|
|
163
|
+
owner: 'human',
|
|
164
|
+
why: 'its checks ran past the watch; look at the run',
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
};
|
|
167
168
|
|
|
168
169
|
|
|
169
170
|
|
|
@@ -173,7 +174,6 @@ const standingAt = (comment, headSha) => comment?.kind === 'standing' &&
|
|
|
173
174
|
comment.setAside.headSha === headSha
|
|
174
175
|
? comment.setAside
|
|
175
176
|
: undefined;
|
|
176
|
-
export const isSetAsideReason = (reason) => KNOWN_REASONS.has(reason);
|
|
177
177
|
const KNOWN_REASONS = new Set(SET_ASIDE_REASONS);
|
|
178
178
|
|
|
179
179
|
|
package/dist/queue-owner.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue-owner.mjs","sourceRoot":"","sources":["../src/queue-owner.mts"],"names":[],"mappings":"AAAA,iCAAiC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AAC9D,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,GACd,MAAM,cAAc,CAAC;AAKtB,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAU,CAAC;AAa1E,+DAA+D;AAC/D,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,iBAAiB;IACjB,YAAY;IACZ,iBAAiB;IACjB,eAAe;IACf,aAAa;IACb,aAAa;IACb,eAAe;IACf,gBAAgB;IAChB,eAAe;CACP,CAAC;AAIX
|
|
1
|
+
{"version":3,"file":"queue-owner.mjs","sourceRoot":"","sources":["../src/queue-owner.mts"],"names":[],"mappings":"AAAA,iCAAiC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;G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AAC,CAAC,EAAE,CAAC,OAAO;YACV,CAAC,CAAC,yDAAyD;YAC3D,CAAC,CAAC,EAAE,CAAC,OAAO,KAAK,EAAE,CAAC,aAAa,IAAI,EAAE,CAAC,SAAS,KAAK,SAAS;gBAC7D,CAAC,CAAE,YAAY,EAAE,CAAC,OAAO,aAAa,EAAE,CAAC,aAAa,iDAA2D;gBACjH,CAAC,CAAC,SAAS,CAAC;AAEtB;;;;GAIG;AACH,MAAM,YAAY,GAAG,CACnB,EAAmB,EACnB,MAAsB,EACtB,MAAe,EACK,EAAE,CACtB,EAAE,CAAC,OAAO,KAAK,qBAAqB,EAAE,CAAC,aAAa,EAAE;IACpD,CAAC,CAAC,yEAAyE;IAC3E,CAAC,CAAC,MAAM,KAAK,eAAe,IAAI,CAAC,MAAM;QACrC,CAAC,CAAC,mDAAmD;QACrD,CAAC,CAAC,SAAS,CAAC"}
|
package/dist/report.d.mts
CHANGED
|
@@ -26,11 +26,6 @@ export declare const buildReport: ({ repo, defaultBranch, generatedAt, required,
|
|
|
26
26
|
*/
|
|
27
27
|
references?: ReadonlyMap<number, ReferenceStatus>;
|
|
28
28
|
}>) => PrReport;
|
|
29
|
-
export type DecidedEntries = Readonly<{
|
|
30
|
-
entries: readonly ReportEntry[];
|
|
31
|
-
roots: readonly TreeNode[];
|
|
32
|
-
cycles: readonly (readonly number[])[];
|
|
33
|
-
}>;
|
|
34
29
|
/**
|
|
35
30
|
* The part of a report that is decided rather than read: each open pull
|
|
36
31
|
* request's declared order, the stack it is in, its check verdict, and the
|
|
@@ -58,4 +53,9 @@ export declare const buildEntries: ({ required, defaultBranch, pulls, issues, sk
|
|
|
58
53
|
*/
|
|
59
54
|
skipCiPauses?: boolean;
|
|
60
55
|
}>) => DecidedEntries;
|
|
56
|
+
export type DecidedEntries = Readonly<{
|
|
57
|
+
entries: readonly ReportEntry[];
|
|
58
|
+
roots: readonly TreeNode[];
|
|
59
|
+
cycles: readonly (readonly number[])[];
|
|
60
|
+
}>;
|
|
61
61
|
//# sourceMappingURL=report.d.mts.map
|
package/dist/report.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.mts","sourceRoot":"","sources":["../src/report.mts"],"names":[],"mappings":"AAAA,yDAAyD;AAOzD,OAAO,
|
|
1
|
+
{"version":3,"file":"report.d.mts","sourceRoot":"","sources":["../src/report.mts"],"names":[],"mappings":"AAAA,yDAAyD;AAOzD,OAAO,EAML,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,WAAW,EAEX,QAAQ,EACT,MAAM,aAAa,CAAC;AAErB;;;;;GAKG;AACH,eAAO,MAAM,WAAW,wJAarB,QAAQ,CAAC;IACV,IAAI,EAAE,OAAO,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACnC,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACrC,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC;;;OAGG;IACH,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CACnD,CAAC,KAAG,QAiBQ,CAAC;AAEd;;;;GAIG;AACH,eAAO,MAAM,YAAY,8DAMtB,QAAQ,CAAC;IACV;;;;OAIG;IACH,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACnC;;;OAGG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC,KAAG,cA6EJ,CAAC;AAuCF,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IAChC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IAC3B,MAAM,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC;CACxC,CAAC,CAAC"}
|
package/dist/report.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { summarizeChecks } from './checks.mjs';
|
|
|
4
4
|
import { SKIP_CI_LABEL } from './labels.mjs';
|
|
5
5
|
import { parseMergeAfter } from './merge-after.mjs';
|
|
6
6
|
import { findStackParents } from './stack.mjs';
|
|
7
|
-
import { decideStartStates, inheritStartAfter, issuesInProgress, withProgress, } from './start-after.mjs';
|
|
7
|
+
import { decideStartStates, inheritStartAfter, issuesInProgress, progressOf, withProgress, } from './start-after.mjs';
|
|
8
8
|
import { buildMergeAfterForest } from './tree.mjs';
|
|
9
9
|
|
|
10
10
|
|
|
@@ -34,29 +34,6 @@ export const buildReport = ({ repo, defaultBranch, generatedAt, required, authen
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
const reportIssues = (issues, pulls, references) => {
|
|
39
|
-
const listed = new Set(issues.map(({ number }) => number));
|
|
40
|
-
const open = new Set(pulls.map(({ number }) => number));
|
|
41
|
-
const statusOf = (number) => listed.has(number) || open.has(number)
|
|
42
|
-
? 'waiting'
|
|
43
|
-
: (references.get(number) ?? 'unknown');
|
|
44
|
-
const states = decideStartStates(issues, statusOf);
|
|
45
|
-
const worked = issuesInProgress(pulls);
|
|
46
|
-
return issues.map((issue) => ({
|
|
47
|
-
...issue,
|
|
48
|
-
start: withProgress(states.get(issue.number) ?? 'free', worked.has(issue.number)),
|
|
49
|
-
named: issue.startAfter.map((number) => ({
|
|
50
|
-
number,
|
|
51
|
-
status: statusOf(number),
|
|
52
|
-
})),
|
|
53
|
-
}));
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
37
|
export const buildEntries = ({ required, defaultBranch, pulls, issues = NO_DECLARATIONS, skipCiPauses = true, }) => {
|
|
61
38
|
const open = new Set(pulls.map(({ number }) => number));
|
|
62
39
|
const parents = findStackParents(pulls, defaultBranch);
|
|
@@ -113,6 +90,29 @@ export const buildEntries = ({ required, defaultBranch, pulls, issues = NO_DECLA
|
|
|
113
90
|
})));
|
|
114
91
|
return { entries, roots, cycles };
|
|
115
92
|
};
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
const reportIssues = (issues, pulls, references) => {
|
|
100
|
+
const listed = new Set(issues.map(({ number }) => number));
|
|
101
|
+
const open = new Set(pulls.map(({ number }) => number));
|
|
102
|
+
const statusOf = (number) => listed.has(number) || open.has(number)
|
|
103
|
+
? 'waiting'
|
|
104
|
+
: (references.get(number) ?? 'unknown');
|
|
105
|
+
const states = decideStartStates(issues, statusOf);
|
|
106
|
+
const worked = issuesInProgress(pulls);
|
|
107
|
+
return issues.map((issue) => ({
|
|
108
|
+
...issue,
|
|
109
|
+
start: withProgress(states.get(issue.number) ?? 'free', progressOf(issue.labels, worked.has(issue.number))),
|
|
110
|
+
named: issue.startAfter.map((number) => ({
|
|
111
|
+
number,
|
|
112
|
+
status: statusOf(number),
|
|
113
|
+
})),
|
|
114
|
+
}));
|
|
115
|
+
};
|
|
116
116
|
const NO_DECLARATIONS = {
|
|
117
117
|
startAfter: new Map(),
|
|
118
118
|
open: new Set(),
|
package/dist/report.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.mjs","sourceRoot":"","sources":["../src/report.mts"],"names":[],"mappings":"AAAA,yDAAyD;AAEzD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,GAEb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAanD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,IAAI,EACJ,aAAa,EACb,WAAW,EACX,QAAQ,EACR,aAAa,EACb,KAAK,EACL,MAAM,EACN,gBAAgB,EAChB,MAAM,EACN,WAAW,EACX,iBAAiB,EACjB,UAAU,GAAG,IAAI,GAAG,EAA2B,GAmB/C,EAAY,EAAE,CACd,CAAC;IACC,IAAI;IACJ,aAAa;IACb,WAAW;IACX,aAAa;IACb,QAAQ;IACR,GAAG,YAAY,CAAC;QACd,QAAQ;QACR,aAAa;QACb,KAAK;QACL,GAAG,CAAC,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC;KAC1E,CAAC;IACF,MAAM;IACN,gBAAgB;IAChB,MAAM,EAAE,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC;IAC/C,WAAW;CACZ,CAAU,CAAC;AAEd
|
|
1
|
+
{"version":3,"file":"report.mjs","sourceRoot":"","sources":["../src/report.mts"],"names":[],"mappings":"AAAA,yDAAyD;AAEzD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,cA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AAM,CAAC;SACzB,CAAC,CAAC;KACJ,CAAC,CAAC,CAAC;AACN,CAAC,CAAC;AAQF,MAAM,eAAe,GAAsB;IACzC,UAAU,EAAE,IAAI,GAAG,EAA6B;IAChD,IAAI,EAAE,IAAI,GAAG,EAAU;CACf,CAAC;AAEX;;;;GAIG;AACH,MAAM,cAAc,GAAG,CACrB,YAA8C,EAC3B,EAAE,CACrB,YAAY;KACT,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,KAAK,QAAQ,CAAC;KACzC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/start-after.d.mts
CHANGED
|
@@ -38,14 +38,39 @@ export type StartState = 'attention' | 'blocked' | 'cycle' | 'free' | 'ready';
|
|
|
38
38
|
*/
|
|
39
39
|
export declare const waitsFor: (body: string, blockedBy: readonly number[]) => readonly number[];
|
|
40
40
|
/**
|
|
41
|
-
* How an issue is shown: its {@link StartState}, or
|
|
42
|
-
*
|
|
43
|
-
* state in the rules (`docs/issue-start-after.md`): one that is blocked
|
|
44
|
-
* on a cycle says so whether or not someone has started it.
|
|
41
|
+
* How an issue is shown: its {@link StartState}, or how far someone has got
|
|
42
|
+
* with it when it is startable ({@link IssueProgress}). Kept apart from the
|
|
43
|
+
* start state in the rules (`docs/issue-start-after.md`): one that is blocked
|
|
44
|
+
* or on a cycle says so whether or not someone has started it.
|
|
45
45
|
*/
|
|
46
|
-
export type IssueStartState = StartState | 'in-progress';
|
|
47
|
-
/**
|
|
48
|
-
|
|
46
|
+
export type IssueStartState = StartState | 'in-progress' | 'planned';
|
|
47
|
+
/**
|
|
48
|
+
* How far someone has got with an issue, whatever it waits for:
|
|
49
|
+
*
|
|
50
|
+
* - `in-progress` — an open pull request closes it, or it is labelled
|
|
51
|
+
* `in-progress` (`labels.mts`), which is how it says so before there is one.
|
|
52
|
+
* - `planned` — it is labelled `planned`: someone means to start it next.
|
|
53
|
+
* - `none` — neither.
|
|
54
|
+
*/
|
|
55
|
+
export type IssueProgress = 'in-progress' | 'none' | 'planned';
|
|
56
|
+
/**
|
|
57
|
+
* The {@link IssueProgress} of an issue carrying `labels`, given whether an
|
|
58
|
+
* open pull request closes it. Being worked on wins over being planned: one
|
|
59
|
+
* carrying both was started without the plan being taken off.
|
|
60
|
+
*/
|
|
61
|
+
export declare const progressOf: (labels: readonly Readonly<{
|
|
62
|
+
name: string;
|
|
63
|
+
}>[], closedByOpenPull: boolean) => IssueProgress;
|
|
64
|
+
/**
|
|
65
|
+
* Whether `labels` holds `name`, whatever its case. GitHub's label names
|
|
66
|
+
* are: adding `in-progress` to a repository that has `In-Progress` puts that
|
|
67
|
+
* one on, so an exact match would not see the label it just added.
|
|
68
|
+
*/
|
|
69
|
+
export declare const hasLabel: (labels: readonly Readonly<{
|
|
70
|
+
name: string;
|
|
71
|
+
}>[], name: string) => boolean;
|
|
72
|
+
/** The {@link IssueStartState} of an issue, given how far it has got. */
|
|
73
|
+
export declare const withProgress: (state: StartState, progress: IssueProgress) => IssueStartState;
|
|
49
74
|
/** The issues an open pull request closes: the ones being worked on. */
|
|
50
75
|
export declare const issuesInProgress: (pulls: readonly Readonly<{
|
|
51
76
|
linkedIssues: readonly Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-after.d.mts","sourceRoot":"","sources":["../src/start-after.mts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"start-after.d.mts","sourceRoot":"","sources":["../src/start-after.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;AAE3E;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;AAE9E;;;;;;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AACH,eAAO,MAAM,iBAAiB,WACpB,SAAS,QAAQ,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/B,CAAC,EAAE,YACM,CAAC,MAAM,EAAE,MAAM,KAAK,eAAe,KAC5C,WAAW,CAAC,MAAM,EAAE,UAAU,CA6BhC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC;;;;OAIG;IACH,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B;;;;OAIG;IACH,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/B,CAAC,CAAC;AAEH;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,yCAI3B,QAAQ,CAAC;IACV,KAAK,EAAE,SAAS,QAAQ,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC,EAAE,CAAC;IAC1E,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;IACrD,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACjC,CAAC,KAAG,WAAW,CAAC,MAAM,EAAE,cAAc,CAoCtC,CAAC"}
|
package/dist/start-after.mjs
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
import { Arr } from 'ts-data-forge';
|
|
7
|
+
import { IN_PROGRESS_LABEL, PLANNED_LABEL } from './labels.mjs';
|
|
7
8
|
import { findMergeAfterCycles, parseStartAfter } from './merge-after.mjs';
|
|
8
9
|
|
|
9
10
|
|
|
@@ -14,7 +15,25 @@ import { findMergeAfterCycles, parseStartAfter } from './merge-after.mjs';
|
|
|
14
15
|
|
|
15
16
|
export const waitsFor = (body, blockedBy) => Arr.uniq(parseStartAfter(body).concat(blockedBy));
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
export const progressOf = (labels, closedByOpenPull) => closedByOpenPull || hasLabel(labels, IN_PROGRESS_LABEL)
|
|
23
|
+
? 'in-progress'
|
|
24
|
+
: hasLabel(labels, PLANNED_LABEL)
|
|
25
|
+
? 'planned'
|
|
26
|
+
: 'none';
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
export const hasLabel = (labels, name) => labels.some((label) => label.name.toLowerCase() === name.toLowerCase());
|
|
33
|
+
|
|
34
|
+
export const withProgress = (state, progress) => progress !== 'none' && (state === 'free' || state === 'ready')
|
|
35
|
+
? progress
|
|
36
|
+
: state;
|
|
18
37
|
|
|
19
38
|
export const issuesInProgress = (pulls) => new Set(pulls.flatMap(({ linkedIssues }) => linkedIssues.map(({ number }) => number)));
|
|
20
39
|
|
package/dist/start-after.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-after.mjs","sourceRoot":"","sources":["../src/start-after.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AA8B1E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,IAAY,EACZ,SAA4B,EACT,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"start-after.mjs","sourceRoot":"","sources":["../src/start-after.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,oBAAoB,E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|
4
4
|
"private": false,
|
|
5
5
|
"description": "What a GitHub merge queue driven by labels and `Merge-After:` trailers decides about the open pull requests — verdicts, merge order, stacks, owners — with no I/O, shared by the GitHub Pull Requests Manager page and the unblock-prs worker",
|
|
6
6
|
"keywords": [
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"cspell": "10.4.0",
|
|
50
50
|
"dedent": "1.7.2",
|
|
51
51
|
"eslint": "10.13.0",
|
|
52
|
-
"eslint-config-typed": "
|
|
53
|
-
"eslint-plugin-ts-data-forge": "0.10.
|
|
54
|
-
"eslint-plugin-ts-fortress": "1.3.
|
|
55
|
-
"eslint-plugin-ts-type-forge": "0.8.
|
|
52
|
+
"eslint-config-typed": "7.2.1",
|
|
53
|
+
"eslint-plugin-ts-data-forge": "0.10.6",
|
|
54
|
+
"eslint-plugin-ts-fortress": "1.3.11",
|
|
55
|
+
"eslint-plugin-ts-type-forge": "0.8.16",
|
|
56
56
|
"jiti": "2.7.0",
|
|
57
57
|
"npm-run-all2": "9.0.4",
|
|
58
58
|
"prettier": "3.9.10",
|
package/src/checks.mts
CHANGED
|
@@ -153,16 +153,6 @@ export const anyRunInProgress = (runs: readonly CheckRunReport[]): boolean =>
|
|
|
153
153
|
(run) => run.status !== 'completed' || run.round?.completed === false,
|
|
154
154
|
);
|
|
155
155
|
|
|
156
|
-
/**
|
|
157
|
-
* Which of two runs of one name GitHub would answer with: the one in the
|
|
158
|
-
* later-created suite, and within one suite the later run of it — a re-run
|
|
159
|
-
* keeps the suite and takes a new run id.
|
|
160
|
-
*/
|
|
161
|
-
const outranks = (run: CheckRunReport, previous: CheckRunReport): boolean =>
|
|
162
|
-
run.checkSuiteId === previous.checkSuiteId
|
|
163
|
-
? run.id > previous.id
|
|
164
|
-
: run.checkSuiteId > previous.checkSuiteId;
|
|
165
|
-
|
|
166
156
|
/**
|
|
167
157
|
* What every context has reported on one commit, from both places GitHub
|
|
168
158
|
* keeps them. The aggregate jobs are check runs; `no-skip-ci-label` is a
|
|
@@ -308,3 +298,13 @@ export const summarizeChecks = ({
|
|
|
308
298
|
required: required.length,
|
|
309
299
|
};
|
|
310
300
|
};
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Which of two runs of one name GitHub would answer with: the one in the
|
|
304
|
+
* later-created suite, and within one suite the later run of it — a re-run
|
|
305
|
+
* keeps the suite and takes a new run id.
|
|
306
|
+
*/
|
|
307
|
+
const outranks = (run: CheckRunReport, previous: CheckRunReport): boolean =>
|
|
308
|
+
run.checkSuiteId === previous.checkSuiteId
|
|
309
|
+
? run.id > previous.id
|
|
310
|
+
: run.checkSuiteId > previous.checkSuiteId;
|
package/src/code-owners.mts
CHANGED
|
@@ -55,87 +55,6 @@ export const ownersOf = (
|
|
|
55
55
|
): readonly string[] =>
|
|
56
56
|
rules.findLast((rule) => toRegExp(rule.pattern).test(path))?.owners ?? [];
|
|
57
57
|
|
|
58
|
-
const stripComment = (line: string): string => {
|
|
59
|
-
const at = line.indexOf('#');
|
|
60
|
-
|
|
61
|
-
return at === -1 ? line : line.slice(0, at);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const toRegExp = (pattern: string): RegExp => {
|
|
65
|
-
const directory = pattern.endsWith('/');
|
|
66
|
-
|
|
67
|
-
const trimmed = pattern.replaceAll(/^\/|\/$/gu, '');
|
|
68
|
-
|
|
69
|
-
// `.gitignore`'s rule: a slash anywhere but at the end ties the pattern to
|
|
70
|
-
// the root, and a pattern without one may match at any depth.
|
|
71
|
-
const anchored = pattern.startsWith('/') || trimmed.includes('/');
|
|
72
|
-
|
|
73
|
-
const body = globToRegExpSource(trimmed);
|
|
74
|
-
|
|
75
|
-
// A directory owns what is under it and never matches as a file. A name
|
|
76
|
-
// with no trailing slash may be either, so it matches itself and what is
|
|
77
|
-
// under it — unless its last segment is a wildcard, which GitHub reads as
|
|
78
|
-
// files at that level only: `docs/*` owns `docs/a.md` and not
|
|
79
|
-
// `docs/build/a.md`.
|
|
80
|
-
const tail = directory
|
|
81
|
-
? '/.+'
|
|
82
|
-
: (trimmed.split('/').at(-1) ?? '').includes('*')
|
|
83
|
-
? ''
|
|
84
|
-
: '(?:/.+)?';
|
|
85
|
-
|
|
86
|
-
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
87
|
-
return new RegExp(`^${anchored ? '' : '(?:.+/)?'}${body}${tail}$`, 'u');
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const globToRegExpSource = (glob: string): string =>
|
|
91
|
-
glob
|
|
92
|
-
.split('/')
|
|
93
|
-
.map((segment, index, segments) =>
|
|
94
|
-
segment === '**'
|
|
95
|
-
? // `a/**/b` is `a/b` as well as `a/x/y/b`, so the separator that
|
|
96
|
-
// follows is part of what `**` may leave out.
|
|
97
|
-
index === segments.length - 1
|
|
98
|
-
? '.*'
|
|
99
|
-
: '(?:.*/)?'
|
|
100
|
-
: `${segment
|
|
101
|
-
.split('')
|
|
102
|
-
.map((char) =>
|
|
103
|
-
char === '*' ? '[^/]*' : char === '?' ? '[^/]' : escapeChar(char),
|
|
104
|
-
)
|
|
105
|
-
.join('')}${index === segments.length - 1 ? '' : '/'}`,
|
|
106
|
-
)
|
|
107
|
-
.join('');
|
|
108
|
-
|
|
109
|
-
// Not `RegExp.escape`: it arrived in Node 24, and `ws:check:test` also runs
|
|
110
|
-
// on the `engines.node` floor (`test-node-versions (minimum)`), which is 22.
|
|
111
|
-
// Under the `u` flag only the syntax characters and `/` may be escaped, and
|
|
112
|
-
// everything else is a literal as it stands.
|
|
113
|
-
const escapeChar = (char: string): string =>
|
|
114
|
-
String.raw`^$\.*+?()[]{}|/`.includes(char) ? (`\\${char}` as const) : char;
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Where a pull request stands with the code owners.
|
|
118
|
-
*
|
|
119
|
-
* `required` lists what is still waiting — the owned paths no owner has
|
|
120
|
-
* approved yet, and who could approve them. `authorOwns` is the case that
|
|
121
|
-
* waits for ever: GitHub does not let an author approve their own pull
|
|
122
|
-
* request, so when the author is the only owner nothing but a ruleset bypass
|
|
123
|
-
* will merge it. `unknown` is a pull request whose changed files were more
|
|
124
|
-
* than could be read, where the unread ones might be owned — or, with
|
|
125
|
-
* `teams`, one approved by someone these teams might have as a member.
|
|
126
|
-
*/
|
|
127
|
-
export type CodeOwnerReview = Readonly<
|
|
128
|
-
| { state: 'approved' }
|
|
129
|
-
| { state: 'not-required' }
|
|
130
|
-
| { state: 'unknown'; teams?: readonly string[] }
|
|
131
|
-
| {
|
|
132
|
-
state: 'required';
|
|
133
|
-
paths: readonly string[];
|
|
134
|
-
owners: readonly string[];
|
|
135
|
-
authorOwns: boolean;
|
|
136
|
-
}
|
|
137
|
-
>;
|
|
138
|
-
|
|
139
58
|
/**
|
|
140
59
|
* What GitHub would say, worked out the way GitHub does: every changed path
|
|
141
60
|
* that has owners needs an approval from one of them. An approval is the
|
|
@@ -225,5 +144,86 @@ export const codeOwnerReview = ({
|
|
|
225
144
|
return owned ? { state: 'approved' } : { state: 'not-required' };
|
|
226
145
|
};
|
|
227
146
|
|
|
147
|
+
const stripComment = (line: string): string => {
|
|
148
|
+
const at = line.indexOf('#');
|
|
149
|
+
|
|
150
|
+
return at === -1 ? line : line.slice(0, at);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// Not `RegExp.escape`: it arrived in Node 24, and `ws:check:test` also runs
|
|
154
|
+
// on the `engines.node` floor (`test-node-versions (minimum)`), which is 22.
|
|
155
|
+
// Under the `u` flag only the syntax characters and `/` may be escaped, and
|
|
156
|
+
// everything else is a literal as it stands.
|
|
157
|
+
const escapeChar = (char: string): string =>
|
|
158
|
+
String.raw`^$\.*+?()[]{}|/`.includes(char) ? (`\\${char}` as const) : char;
|
|
159
|
+
|
|
160
|
+
const globToRegExpSource = (glob: string): string =>
|
|
161
|
+
glob
|
|
162
|
+
.split('/')
|
|
163
|
+
.map((segment, index, segments) =>
|
|
164
|
+
segment === '**'
|
|
165
|
+
? // `a/**/b` is `a/b` as well as `a/x/y/b`, so the separator that
|
|
166
|
+
// follows is part of what `**` may leave out.
|
|
167
|
+
index === segments.length - 1
|
|
168
|
+
? '.*'
|
|
169
|
+
: '(?:.*/)?'
|
|
170
|
+
: `${segment
|
|
171
|
+
.split('')
|
|
172
|
+
.map((char) =>
|
|
173
|
+
char === '*' ? '[^/]*' : char === '?' ? '[^/]' : escapeChar(char),
|
|
174
|
+
)
|
|
175
|
+
.join('')}${index === segments.length - 1 ? '' : '/'}`,
|
|
176
|
+
)
|
|
177
|
+
.join('');
|
|
178
|
+
|
|
179
|
+
const toRegExp = (pattern: string): RegExp => {
|
|
180
|
+
const directory = pattern.endsWith('/');
|
|
181
|
+
|
|
182
|
+
const trimmed = pattern.replaceAll(/^\/|\/$/gu, '');
|
|
183
|
+
|
|
184
|
+
// `.gitignore`'s rule: a slash anywhere but at the end ties the pattern to
|
|
185
|
+
// the root, and a pattern without one may match at any depth.
|
|
186
|
+
const anchored = pattern.startsWith('/') || trimmed.includes('/');
|
|
187
|
+
|
|
188
|
+
const body = globToRegExpSource(trimmed);
|
|
189
|
+
|
|
190
|
+
// A directory owns what is under it and never matches as a file. A name
|
|
191
|
+
// with no trailing slash may be either, so it matches itself and what is
|
|
192
|
+
// under it — unless its last segment is a wildcard, which GitHub reads as
|
|
193
|
+
// files at that level only: `docs/*` owns `docs/a.md` and not
|
|
194
|
+
// `docs/build/a.md`.
|
|
195
|
+
const tail = directory
|
|
196
|
+
? '/.+'
|
|
197
|
+
: (trimmed.split('/').at(-1) ?? '').includes('*')
|
|
198
|
+
? ''
|
|
199
|
+
: '(?:/.+)?';
|
|
200
|
+
|
|
201
|
+
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
202
|
+
return new RegExp(`^${anchored ? '' : '(?:.+/)?'}${body}${tail}$`, 'u');
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Where a pull request stands with the code owners.
|
|
207
|
+
*
|
|
208
|
+
* `required` lists what is still waiting — the owned paths no owner has
|
|
209
|
+
* approved yet, and who could approve them. `authorOwns` is the case that
|
|
210
|
+
* waits for ever: GitHub does not let an author approve their own pull
|
|
211
|
+
* request, so when the author is the only owner nothing but a ruleset bypass
|
|
212
|
+
* will merge it. `unknown` is a pull request whose changed files were more
|
|
213
|
+
* than could be read, where the unread ones might be owned — or, with
|
|
214
|
+
* `teams`, one approved by someone these teams might have as a member.
|
|
215
|
+
*/
|
|
216
|
+
export type CodeOwnerReview = Readonly<
|
|
217
|
+
| { state: 'approved' }
|
|
218
|
+
| { state: 'not-required' }
|
|
219
|
+
| { state: 'unknown'; teams?: readonly string[] }
|
|
220
|
+
| {
|
|
221
|
+
state: 'required';
|
|
222
|
+
paths: readonly string[];
|
|
223
|
+
owners: readonly string[];
|
|
224
|
+
authorOwns: boolean;
|
|
225
|
+
}
|
|
226
|
+
>;
|
|
227
|
+
|
|
228
228
|
/** `org/team`, as opposed to a person's login or an email address. */
|
|
229
229
|
const isTeam = (owner: string): boolean => owner.includes('/');
|