Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

ci(triage): apply path-derived topic labels at PR open (#4957)

LearningCircuit5e0ce1a15e9a
diff --git a/.github/workflows/pr-triage.yml b/.github/workflows/pr-triage.yml
index b46c983159..aca579dbfd 100644
--- a/.github/workflows/pr-triage.yml
+++ b/.github/workflows/pr-triage.yml
@@ -4,6 +4,15 @@ name: PR triage labels
# on review/synchronize events. Labels are defined in .github/labels.yml
# and synced by .github/workflows/labels-sync.yml.
#
+# Also applies path-derived topic labels (documentation, tests, docker,
+# github-actions, ...) that feed release-notes categorization. These were
+# historically applied by the AI code reviewer, which became label-only
+# opt-in (#4955), so triage now owns the mechanical subset. Topic labels
+# are applied on opened and ready_for_review only, and are additive-only:
+# a label a maintainer removed is not re-added on every push, and
+# semantic labels (bugfix, feature, security, performance...) stay
+# human/AI-applied.
+#
# Uses pull_request (not pull_request_target) — fork PRs get a read-only
# token, so label calls return 403. The script catches 403 and continues
# so fork PRs don't show a failing check; maintainers can apply labels
@@ -33,7 +42,8 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
- issues: write # PR labels live on the underlying issue resource
+ issues: write # PR labels live on the underlying issue resource
+ pull-requests: read # listFiles for path-derived topic labels
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
@@ -95,6 +105,41 @@ jobs:
}
};
+ // Path-derived topic labels for release-notes categorization.
+ // Mechanical mappings only — a rule belongs here iff the label
+ // follows from *which files* changed, never from what the
+ // change means. First-match-per-rule over all changed files.
+ const TOPIC_RULES = [
+ [/^\.github\/workflows\//, 'github-actions'],
+ [/^(\.github\/|\.pre-commit-hooks\/|\.pre-commit-config\.yaml$|scripts\/ci\/)/, 'ci-cd'],
+ [/^(Dockerfile|docker-compose|cookiecutter-docker\/|unraid-templates\/)/, 'docker'],
+ [/^(docs\/|[^/]+\.md$)/, 'documentation'],
+ [/^tests\//, 'tests'],
+ [/^src\/local_deep_research\/database\//, 'database'],
+ [/^src\/local_deep_research\/(defaults|settings)\//, 'configuration'],
+ [/^(pyproject\.toml|pdm\.lock|package\.json|package-lock\.json)$/, 'dependencies'],
+ [/^src\/local_deep_research\/(advanced_search_system|web_search_engines)\//, 'research'],
+ [/^src\/.*\.py$/, 'python'],
+ [/^src\/.*\.(js|mjs)$/, 'javascript'],
+ [/^src\/.*\.css$/, 'css'],
+ ];
+
+ const topicLabels = async () => {
+ const files = await github.paginate(github.rest.pulls.listFiles, {
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ pull_number: issueNumber,
+ per_page: 100,
+ });
+ const labels = new Set();
+ for (const f of files) {
+ for (const [pattern, label] of TOPIC_RULES) {
+ if (pattern.test(f.filename)) labels.add(label);
+ }
+ }
+ return [...labels];
+ };
+
const action = context.payload.action;
const eventName = context.eventName;
@@ -104,6 +149,7 @@ jobs:
if (!isInternal && !isBot) labels.push('external-contributor');
if (association === 'FIRST_TIME_CONTRIBUTOR') labels.push('first-time-contributor');
if (!isInternal) labels.push('needs-codeowner-review');
+ labels.push(...await topicLabels());
await addLabels(labels);
return;
}
@@ -114,6 +160,13 @@ jobs:
await removeLabel('awaiting-author');
await addLabels(['awaiting-codeowner']);
}
+ // Draft → ready is a deliberate "the diff is final" moment, so
+ // recompute topic labels once there. Deliberately NOT done on
+ // synchronize: that would re-add labels a maintainer removed,
+ // on every push.
+ if (action === 'ready_for_review') {
+ await addLabels(await topicLabels());
+ }
return;
}