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"]); +});