From 4583ed246ff9416ba8ebb3a7303496d31d991086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=AE=B6=E5=90=8D?= Date: Sun, 14 Jun 2026 16:50:19 +0800 Subject: [PATCH] fix: classify harness docs as documentation (#349) --- .github/scripts/pr-labeler.js | 9 +++++++-- .github/scripts/tests/pr-labeler.test.js | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/scripts/pr-labeler.js b/.github/scripts/pr-labeler.js index 25aa62950..bda2757c0 100644 --- a/.github/scripts/pr-labeler.js +++ b/.github/scripts/pr-labeler.js @@ -52,10 +52,15 @@ function isDocumentationFile(path) { /^README(?:_[A-Z]+)?\.md$/.test(path) || /^(CONTRIBUTING|SECURITY)\.md$/.test(path) || /^docs\//.test(path) || + /^[^/]+\/agent-harness\/.*\.md$/i.test(path) || /^[^/]+\.md$/i.test(path) ); } +function isHarnessImplementationFile(path) { + return isHarnessFile(path) && !isDocumentationFile(path); +} + function titleLooksLikeRegistryCli(title) { return /\b(add|introduce|new)\b/i.test(title) && /\b(cli|harness|registry)\b/i.test(title); } @@ -64,7 +69,7 @@ function computeScriptLabels(files, title) { const paths = files.map((file) => file.filename); const labelsToApply = new Set(); - const hasHarnessChange = paths.some(isHarnessFile); + const hasHarnessImplementationChange = paths.some(isHarnessImplementationFile); const hasNewHarness = files.some(isNewHarnessManifest); const registryOnly = paths.length > 0 && paths.every((path) => REGISTRY_FILES.has(path)); const registryNewCli = registryOnly && titleLooksLikeRegistryCli(title || ""); @@ -72,7 +77,7 @@ function computeScriptLabels(files, title) { if (hasNewHarness || registryNewCli) { labelsToApply.add("new-cli"); - } else if (hasHarnessChange) { + } else if (hasHarnessImplementationChange) { labelsToApply.add("existing-cli-fix"); } diff --git a/.github/scripts/tests/pr-labeler.test.js b/.github/scripts/tests/pr-labeler.test.js index 887e7d863..6c48a4b21 100644 --- a/.github/scripts/tests/pr-labeler.test.js +++ b/.github/scripts/tests/pr-labeler.test.js @@ -197,3 +197,12 @@ test("mixed README and harness changes are not documentation-only", () => { assert.deepStrictEqual(labels, ["existing-cli-fix"]); }); + +test("harness README-only changes are documentation", () => { + const labels = computeAllLabels({ + title: "docs(firefly-iii): clarify setup notes", + files: [{filename: "firefly-iii/agent-harness/README.md", status: "modified"}], + }); + + assert.deepStrictEqual(labels, ["documentation"]); +});