ci: harden description checks — unfilled dropdowns, gameable test plans, non-issue links (#2099)
* ci: harden description checks (dropdown placeholder, how-to-test, link \b) - issue: flag sections still showing the "-- Please Select --" dropdown placeholder (added in #2068) as a single comma-separated line item; presence-only checks previously let an un-chosen dropdown pass. - PR: replace the numbered-step "How to Test" rule with a non-trivial content requirement (>=30 chars). The old /\d+\.\s*\S/ rule both false-failed prose/code-block test plans and was gamed by an empty "1. 2. 3." shell; the message now explains what detail to provide. - PR: tighten the linked-issue regex to /#\d+\b/ so a hex colour like #1a2b3c no longer counts as an issue reference. --------- Co-authored-by: Povilas Kirna <povilas.kirna@pebble.net> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
31
.github/scripts/check-issue-description.js
vendored
31
.github/scripts/check-issue-description.js
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user