diff --git a/.github/scripts/issue-template-compliance.mjs b/.github/scripts/issue-template-compliance.mjs new file mode 100644 index 00000000000..84719e3978a --- /dev/null +++ b/.github/scripts/issue-template-compliance.mjs @@ -0,0 +1,163 @@ +import { appendFileSync, readFileSync } from 'node:fs' +import { pathToFileURL } from 'node:url' + +// Why hardcoded: the runner has no YAML parser without a pnpm install. The +// vitest drift guard fails whenever these diverge from .github/ISSUE_TEMPLATE. +export const ISSUE_TEMPLATES = [ + { file: 'bug_report.yml', name: 'Bug report', requiredFields: ['Operating system', 'Details'] }, + { + file: 'feature_request.yml', + name: 'Feature request', + requiredFields: ['Problem or use case', 'Proposed solution'] + }, + { file: 'other.yml', name: 'Other', requiredFields: ['Details'] } +] + +export const COMPLIANCE_LABEL = 'needs-template' +export const COMMENT_MARKER = '' +// Why: GitHub renders a skipped optional form field as this literal. +const EMPTY_FIELD_VALUE = '_No response_' + +// Issue forms render each field as `###