aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/issue-gate.yml31
1 files changed, 24 insertions, 7 deletions
diff --git a/.github/workflows/issue-gate.yml b/.github/workflows/issue-gate.yml
index e5ad5846..ff7a22d9 100644
--- a/.github/workflows/issue-gate.yml
+++ b/.github/workflows/issue-gate.yml
@@ -31,10 +31,22 @@ jobs:
'### Environment',
];
const requiredEnvironmentFields = [
- /^\s*(?:-\s*)?Herdr version:[^\S\r\n]*\S.*$/m,
- /^\s*(?:-\s*)?Update channel(?: \([^)]+\))?:[^\S\r\n]*\S.*$/im,
- /^\s*(?:-\s*)?Operating system:[^\S\r\n]*\S.*$/m,
- /^\s*(?:-\s*)?Terminal:[^\S\r\n]*\S.*$/m,
+ {
+ label: 'herdr version',
+ pattern: /^\s*(?:-\s*)?Herdr version:[^\S\r\n]*\S.*$/im,
+ },
+ {
+ label: 'update channel',
+ pattern: /^\s*(?:-\s*)?(?:Update channel(?: \([^)]+\))?|Channel):[^\S\r\n]*\S.*$/im,
+ },
+ {
+ label: 'operating system',
+ pattern: /^\s*(?:-\s*)?(?:Operating system|OS):[^\S\r\n]*\S.*$/im,
+ },
+ {
+ label: 'terminal',
+ pattern: /^\s*(?:-\s*)?Terminal:[^\S\r\n]*\S.*$/im,
+ },
];
function escapeRegExp(value) {
@@ -125,7 +137,12 @@ jobs:
reproduction,
impact,
].every(hasContent);
- const hasEnvironmentFields = hasContent(environment) && requiredEnvironmentFields.every((pattern) => pattern.test(environment));
+ const missingEnvironmentFields = hasContent(environment)
+ ? requiredEnvironmentFields
+ .filter((field) => !field.pattern.test(environment))
+ .map((field) => field.label)
+ : requiredEnvironmentFields.map((field) => field.label);
+ const hasEnvironmentFields = missingEnvironmentFields.length === 0;
if (hasBugConfirmation && hasBugTemplate && extraHeadings.length > 0) {
const message = [
`hi @${author}, thanks for opening this.`,
@@ -135,7 +152,7 @@ jobs:
'please use the exact template sections only. bug reports should describe observed behavior, exact reproduction steps, impact, and environment. extra root-cause analysis, proposed fixes, implementation plans, or generated diagnosis make reports harder to triage.',
...(hasEnvironmentFields ? [] : [
'',
- 'this report is also missing required environment details: herdr version, update channel, operating system, and terminal.',
+ `this report is also missing required environment details: ${missingEnvironmentFields.join(', ')}.`,
]),
'',
'closing this so the issue tracker stays limited to concise, actionable bug reports.',
@@ -167,7 +184,7 @@ jobs:
const message = [
`hi @${author}, thanks for opening this.`,
'',
- 'this bug report is missing required environment details. please edit the issue and fill in herdr version, update channel, operating system, and terminal.',
+ `this bug report is missing required environment details: ${missingEnvironmentFields.join(', ')}. please edit the issue and fill in the missing fields.`,
'',
'shell and relevant config are optional, but they help when they affect the bug.',
].join('\n');