fix(ci): issue labeler no-oped on every issue — (?i) is invalid in JS RegExp

github/issue-labeler compiles patterns with JavaScript RegExp, which
rejects PCRE-only inline (?i) groups with SyntaxError: Invalid group, so
the workflow failed before evaluating any rule and no issue ever got an
area label (#764).

Replace the third-party action with first-party actions/github-script:
the same config rules are compiled with the i flag applied centrally
(case-insensitivity preserved), labels stay additive-only via addLabels,
and a pattern that fails to compile now fails the run loudly instead of
silently no-oping. Strip (?i) from all 7 config patterns and document
the line format the workflow parses.

Verified locally: all 7 rules compile and match expected labels across
sample issue texts; the old pattern reproduces the SyntaxError.

Closes #764

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
This commit is contained in:
Martin Vogel committed 2026-07-10 00:03:43 +02:00
1 parent 2dca0a39be
commit fff4761d37
2 files changed
+54 -19

No files matched your search

+13 -9
View File
@@ -1,17 +1,21 @@
# Config for github/issue-labeler (.github/workflows/issue-labeler.yml).
# Non-versioned format: one regex per label, matched against title + body.
# Config for the Issue area labeler (.github/workflows/issue-labeler.yml).
# FORMAT (parsed line-wise by the workflow): one rule per line, exactly
# "label": 'regex'
# Patterns are compiled as JavaScript RegExp with the `i` flag applied by
# the workflow — do NOT use PCRE-only syntax like inline `(?i)` groups
# (that broke every run, #764). Matched against issue title + body.
# Additive only — these never remove a maintainer's manual label.
"windows": '(?i)\b(windows|win\s?1[01]|powershell|\.ps1|mapped drive|smb share|unc path)\b'
"windows": '\b(windows|win\s?1[01]|powershell|\.ps1|mapped drive|smb share|unc path)\b'
"stability/performance": '(?i)(out of memory|\boom\b|memory leak|segfault|sigsegv|sigbus|crash(es|ed|ing)?|core dumped|\bhang(s|ing)?\b|deadlock|freezes?|time(s)?\s?out|timeout|never finishes|cgroup)'
"stability/performance": '(out of memory|\boom\b|memory leak|segfault|sigsegv|sigbus|crash(es|ed|ing)?|core dumped|\bhang(s|ing)?\b|deadlock|freezes?|time(s)?\s?out|timeout|never finishes|cgroup)'
"parsing/quality": '(?i)(trace_path|query_graph|search_graph|calls? edge|missing (edges|nodes)|false positive|zero edges|0 edges|module node|not indexed|extraction|wrong (node|label))'
"parsing/quality": '(trace_path|query_graph|search_graph|calls? edge|missing (edges|nodes)|false positive|zero edges|0 edges|module node|not indexed|extraction|wrong (node|label))'
"editor/integration": '(?i)(cursor|vscode|vs code|opencode|codex|claude code|gemini cli|antigravity|mcp client|\.mcp\.json|installer)'
"editor/integration": '(cursor|vscode|vs code|opencode|codex|claude code|gemini cli|antigravity|mcp client|\.mcp\.json|installer)'
"ux/behavior": '(?i)(web ui|\bui\b|dashboard|3d graph|visuali[sz]ation|watcher|project name|frontend)'
"ux/behavior": '(web ui|\bui\b|dashboard|3d graph|visuali[sz]ation|watcher|project name|frontend)'
"cypher": '(?i)\bcypher\b'
"cypher": '\bcypher\b'
"language-request": '(?i)(language support|hybrid lsp|new language support|support for \w+ language)'
"language-request": '(language support|hybrid lsp|new language support|support for \w+ language)'
+41 -10
View File
@@ -1,9 +1,15 @@
name: Issue area labeler
# Adds area labels to new/edited issues based on keyword regexes in
# .github/issue-labeler.yml. Additive only (sync-labels off): it never
# removes a label a maintainer set by hand. Base bug/enhancement labels
# already come from the issue forms.
# .github/issue-labeler.yml. Additive only (addLabels never removes): it
# never touches a label a maintainer set by hand. Base bug/enhancement
# labels already come from the issue forms.
#
# Implemented with first-party actions/github-script (not a third-party
# labeler action) so every pattern is compiled as a JavaScript RegExp with
# the `i` flag applied centrally — inline `(?i)` groups are PCRE-only and
# threw `SyntaxError: Invalid group` on every issue (#764). A pattern that
# fails to compile now fails the run loudly instead of silently no-oping.
on:
issues:
@@ -16,13 +22,38 @@ jobs:
triage:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- uses: github/issue-labeler@c1b0f9f52a63158c4adc09425e858e87b32e9685 # v3.4
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
configuration-path: .github/issue-labeler.yml
enable-versioned-regex: 0
include-title: 1
include-body: 1
sync-labels: 0
repo-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const text = [context.payload.issue.title, context.payload.issue.body]
.filter(Boolean).join('\n');
const rules = [];
const bad = [];
// Config format: one rule per line — "label": 'regex' (see the
// header comment in .github/issue-labeler.yml).
for (const line of fs.readFileSync('.github/issue-labeler.yml', 'utf8').split('\n')) {
const m = line.match(/^"([^"]+)":\s*'(.*)'\s*$/);
if (!m) continue;
try { rules.push({ label: m[1], re: new RegExp(m[2], 'i') }); }
catch (e) { bad.push(`${m[1]}: ${e.message}`); }
}
if (rules.length === 0 && bad.length === 0) {
core.setFailed('no labeling rules parsed from .github/issue-labeler.yml');
return;
}
const labels = rules.filter(r => r.re.test(text)).map(r => r.label);
if (labels.length) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels,
});
}
core.info(`matched: ${labels.join(', ') || '(none)'}`);
if (bad.length) core.setFailed(`invalid label regex(es): ${bad.join('; ')}`);