Skip to content

Self-hosted AI workspace.

Python

ci: harden description checks — unfilled dropdowns, gameable test plans, non-issue links (#2099)

Povilas Kirna7afd522d1090
diff --git a/.github/scripts/check-issue-description.js b/.github/scripts/check-issue-description.js
index 2156082d0..a76ca29ab 100644
--- a/.github/scripts/check-issue-description.js
+++ b/.github/scripts/check-issue-description.js
@@ -91,6 +91,37 @@ module.exports = async ({ github, context, core }) => {
// 'untyped' → only the common body-length check applies.
}
+ // ── Unfilled dropdowns ────────────────────────────────────────────────────
+ // #2068 added a "-- Please Select --" default to every template dropdown, so
+ // a contributor who never opens the dropdown submits with that literal string
+ // as the section value. The per-section checks above only verify presence, so
+ // a placeholder value passes. Scan every section and flag the ones still
+ // showing the placeholder, as a single comma-separated line item.
+ const PLACEHOLDER = '-- Please Select --';
+ const headingRe = /^#+\s+(.+?)\s*$/gm;
+ const headings = [];
+ let headingMatch;
+ while ((headingMatch = headingRe.exec(body)) !== null) {
+ headings.push({
+ name: headingMatch[1].trim(),
+ headStart: headingMatch.index,
+ contentStart: headingMatch.index + headingMatch[0].length,
+ });
+ }
+ const unfilled = [];
+ for (let i = 0; i < headings.length; i++) {
+ const end = i + 1 < headings.length ? headings[i + 1].headStart : body.length;
+ if (body.slice(headings[i].contentStart, end).includes(PLACEHOLDER)) {
+ unfilled.push(headings[i].name);
+ }
+ }
+ if (unfilled.length > 0) {
+ failures.push(
+ `**Unfilled dropdowns** — please choose a value; these sections still show ` +
+ `the \`${PLACEHOLDER}\` placeholder: ${unfilled.join(', ')}.`,
+ );
+ }
+
// ── Labels ────────────────────────────────────────────────────────────────
// These labels are expected to already exist in the repo — managing the
// repo's label set is the maintainer's job, not this workflow's. We check a
diff --git a/.github/scripts/check-pr-description.js b/.github/scripts/check-pr-description.js
index 277d789f6..2a06c2b36 100644
--- a/.github/scripts/check-pr-description.js
+++ b/.github/scripts/check-pr-description.js
@@ -32,7 +32,7 @@ module.exports = async ({ github, context, core }) => {
// keyword + #NNN, or a full issue URL (e.g. .../issues/123) — the strict
// keyword-prefixed form previously false-flagged correctly-linked PRs.
const linkedSection = section('Linked Issue');
- const hasIssueRef = /#\d+/.test(linkedSection) || /\/issues\/\d+/.test(linkedSection);
+ const hasIssueRef = /#\d+\b/.test(linkedSection) || /\/issues\/\d+/.test(linkedSection);
if (!linkedSection || !hasIssueRef) {
problems.push('**Linked Issue** — add a reference like `Fixes #NNN`, a bare `#NNN`, or a link to the issue.');
}
@@ -48,10 +48,12 @@ module.exports = async ({ github, context, core }) => {
problems.push('**Checklist** — check the duplicate-search box to confirm you searched existing issues and PRs.');
}
- // 5. How to Test must have at least one numbered step.
+ // 5. How to Test must contain enough real detail for a reviewer to act on.
+ // Any format is fine — numbered steps, prose, the commands you ran, or a
+ // code block — so we only require non-trivial content, not a specific shape.
const howTo = section('How to Test');
- if (!howTo || !/\d+\.\s*\S/.test(howTo)) {
- problems.push('**How to Test** — add at least one numbered step a reviewer can follow to verify this works.');
+ if (howTo.length < 30) {
+ problems.push('**How to Test** — explain how a reviewer can verify this change. Numbered steps, the commands you ran, or a short code block all work — give a sentence or two of real detail (not just "tested locally").');
}
// ── Comment ──────────────────────────────────────────────────────────────