Kernel pause: pull requests are judged by the kernel directories they change (#10807)
A pull request outside crates/kernel, crates/geom and vendor/truck* is no longer labelled for a kernel word in its title. Issues and discussions keep the title check. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
'use strict';
|
||||
// While a new geometry kernel is evaluated, new issues, pull requests and discussions about
|
||||
// kernel work get the `kernel-paused` label, so a maintainer finds them and answers in person
|
||||
// (CONTRIBUTING.md, "Kernel work is paused"). Reports of crashes and data loss are left alone,
|
||||
// and so is anyone who can push to the repository.
|
||||
// While a new geometry kernel is evaluated, new issues and discussions about kernel work, and new
|
||||
// pull requests that change the kernel directories, get the `kernel-paused` label, so a maintainer
|
||||
// finds them and answers in person (CONTRIBUTING.md, "Kernel work is paused"). Reports of crashes
|
||||
// and data loss are left alone, and so is anyone who can push to the repository.
|
||||
|
||||
const LABEL = 'kernel-paused';
|
||||
const LABEL_COLOR = 'b60205';
|
||||
const LABEL_DESCRIPTION = 'Kernel work is paused while a new geometry kernel is evaluated';
|
||||
|
||||
// Kernel operations named in a title. "Hole" and "shell" are left out on purpose: they name UI
|
||||
// work too, and a pull request that changes the kernel is caught by its files.
|
||||
// Kernel operations named in the title of an issue or discussion. "Hole" and "shell" are left out
|
||||
// on purpose: they name UI work too. A pull request is judged by its files, never by its title.
|
||||
const TOPIC =
|
||||
/\b(booleans?|fillets?|chamfers?|offsets?|sweeps?|lofts?|threads?|step|stp|iges|igs|tessellat\w*|kernel|truck|b-?rep)\b/i;
|
||||
// Crashes and lost work come first whatever the kernel is.
|
||||
const URGENT = /\b(crash\w*|panic\w*|data loss|lost (my )?work|corrupt\w*)\b/i;
|
||||
// What a pull request changes that makes it kernel work.
|
||||
const KERNEL_PATHS = ['crates/kernel/', 'vendor/truck'];
|
||||
const KERNEL_PATHS = ['crates/kernel/', 'crates/geom/', 'vendor/truck'];
|
||||
|
||||
function isTopic(title) {
|
||||
return TOPIC.test(title || '');
|
||||
@@ -55,10 +55,12 @@ async function handleOpened({ github, context }) {
|
||||
const pull = Boolean(context.payload.pull_request);
|
||||
if (isUrgent(item.title, item.body)) return `#${item.number}: a crash or data-loss report, left alone`;
|
||||
if (await canPush({ github, context }, item.user.login)) return `#${item.number}: by a maintainer, left alone`;
|
||||
let kernel = isTopic(item.title);
|
||||
if (pull && !kernel) {
|
||||
let kernel;
|
||||
if (pull) {
|
||||
const files = await github.paginate(github.rest.pulls.listFiles, { ...context.repo, pull_number: item.number, per_page: 100 });
|
||||
kernel = touchesKernel(files.map((f) => f.filename));
|
||||
} else {
|
||||
kernel = isTopic(item.title);
|
||||
}
|
||||
if (!kernel) return `#${item.number}: not kernel work`;
|
||||
await ensureLabel({ github, context });
|
||||
|
||||
@@ -80,6 +80,20 @@ test('a pull request outside the kernel is left alone', async () => {
|
||||
assert.deepEqual(calls, []);
|
||||
});
|
||||
|
||||
test('a pull request with a kernel topic in its title but no kernel files is left alone', async () => {
|
||||
const { github, calls } = fake({ files: ['crates/ui-egui/src/dialogs.rs'] });
|
||||
const pr = { number: 10, title: 'Fillet dialog: a clearer radius field', body: '', draft: false, node_id: 'PR_3', user: { login: 'someone' } };
|
||||
await paused.handleOpened({ github, context: { repo, payload: { pull_request: pr } } });
|
||||
assert.deepEqual(calls, []);
|
||||
});
|
||||
|
||||
test('a pull request that changes crates/geom is labelled', async () => {
|
||||
const { github, calls } = fake({ files: ['crates/geom/src/lib.rs'] });
|
||||
const pr = { number: 11, title: 'Tidy a helper', body: '', draft: false, node_id: 'PR_4', user: { login: 'someone' } };
|
||||
await paused.handleOpened({ github, context: { repo, payload: { pull_request: pr } } });
|
||||
assert.deepEqual(names(calls), ['addLabels']);
|
||||
});
|
||||
|
||||
test('a kernel discussion is labelled', async () => {
|
||||
const { github, calls } = fake();
|
||||
const d = { number: 3, title: 'Ideas for better booleans', body: '', node_id: 'D_1', user: { login: 'someone' } };
|
||||
|
||||
Reference in New Issue
Block a user