Skip to content

Commit 6b57db2

Browse files
authored
Merge pull request DeusData#990 from DeusData/fix/issue-labeler-regex
fix(ci): issue labeler no-oped on every issue — (?i) is invalid in JS RegExp
2 parents 9a497c0 + fff4761 commit 6b57db2

2 files changed

Lines changed: 54 additions & 19 deletions

File tree

‎.github/issue-labeler.yml‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1-
# Config for github/issue-labeler (.github/workflows/issue-labeler.yml).
2-
# Non-versioned format: one regex per label, matched against title + body.
1+
# Config for the Issue area labeler (.github/workflows/issue-labeler.yml).
2+
# FORMAT (parsed line-wise by the workflow): one rule per line, exactly
3+
# "label": 'regex'
4+
# Patterns are compiled as JavaScript RegExp with the `i` flag applied by
5+
# the workflow — do NOT use PCRE-only syntax like inline `(?i)` groups
6+
# (that broke every run, #764). Matched against issue title + body.
37
# Additive only — these never remove a maintainer's manual label.
48

5-
"windows": '(?i)\b(windows|win\s?1[01]|powershell|\.ps1|mapped drive|smb share|unc path)\b'
9+
"windows": '\b(windows|win\s?1[01]|powershell|\.ps1|mapped drive|smb share|unc path)\b'
610

7-
"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)'
11+
"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)'
812

9-
"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))'
13+
"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))'
1014

11-
"editor/integration": '(?i)(cursor|vscode|vs code|opencode|codex|claude code|gemini cli|antigravity|mcp client|\.mcp\.json|installer)'
15+
"editor/integration": '(cursor|vscode|vs code|opencode|codex|claude code|gemini cli|antigravity|mcp client|\.mcp\.json|installer)'
1216

13-
"ux/behavior": '(?i)(web ui|\bui\b|dashboard|3d graph|visuali[sz]ation|watcher|project name|frontend)'
17+
"ux/behavior": '(web ui|\bui\b|dashboard|3d graph|visuali[sz]ation|watcher|project name|frontend)'
1418

15-
"cypher": '(?i)\bcypher\b'
19+
"cypher": '\bcypher\b'
1620

17-
"language-request": '(?i)(language support|hybrid lsp|new language support|support for \w+ language)'
21+
"language-request": '(language support|hybrid lsp|new language support|support for \w+ language)'
Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
name: Issue area labeler
22

33
# Adds area labels to new/edited issues based on keyword regexes in
4-
# .github/issue-labeler.yml. Additive only (sync-labels off): it never
5-
# removes a label a maintainer set by hand. Base bug/enhancement labels
6-
# already come from the issue forms.
4+
# .github/issue-labeler.yml. Additive only (addLabels never removes): it
5+
# never touches a label a maintainer set by hand. Base bug/enhancement
6+
# labels already come from the issue forms.
7+
#
8+
# Implemented with first-party actions/github-script (not a third-party
9+
# labeler action) so every pattern is compiled as a JavaScript RegExp with
10+
# the `i` flag applied centrally — inline `(?i)` groups are PCRE-only and
11+
# threw `SyntaxError: Invalid group` on every issue (#764). A pattern that
12+
# fails to compile now fails the run loudly instead of silently no-oping.
713

814
on:
915
issues:
@@ -16,13 +22,38 @@ jobs:
1622
triage:
1723
runs-on: ubuntu-latest
1824
permissions:
25+
contents: read
1926
issues: write
2027
steps:
21-
- uses: github/issue-labeler@c1b0f9f52a63158c4adc09425e858e87b32e9685 # v3.4
28+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
29+
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
2230
with:
23-
configuration-path: .github/issue-labeler.yml
24-
enable-versioned-regex: 0
25-
include-title: 1
26-
include-body: 1
27-
sync-labels: 0
28-
repo-token: ${{ secrets.GITHUB_TOKEN }}
31+
script: |
32+
const fs = require('fs');
33+
const text = [context.payload.issue.title, context.payload.issue.body]
34+
.filter(Boolean).join('\n');
35+
const rules = [];
36+
const bad = [];
37+
// Config format: one rule per line — "label": 'regex' (see the
38+
// header comment in .github/issue-labeler.yml).
39+
for (const line of fs.readFileSync('.github/issue-labeler.yml', 'utf8').split('\n')) {
40+
const m = line.match(/^"([^"]+)":\s*'(.*)'\s*$/);
41+
if (!m) continue;
42+
try { rules.push({ label: m[1], re: new RegExp(m[2], 'i') }); }
43+
catch (e) { bad.push(`${m[1]}: ${e.message}`); }
44+
}
45+
if (rules.length === 0 && bad.length === 0) {
46+
core.setFailed('no labeling rules parsed from .github/issue-labeler.yml');
47+
return;
48+
}
49+
const labels = rules.filter(r => r.re.test(text)).map(r => r.label);
50+
if (labels.length) {
51+
await github.rest.issues.addLabels({
52+
owner: context.repo.owner,
53+
repo: context.repo.repo,
54+
issue_number: context.issue.number,
55+
labels,
56+
});
57+
}
58+
core.info(`matched: ${labels.join(', ') || '(none)'}`);
59+
if (bad.length) core.setFailed(`invalid label regex(es): ${bad.join('; ')}`);

0 commit comments

Comments
 (0)