fix: classify harness docs as documentation (#349)

This commit is contained in:
陈家名
2026-06-14 16:50:19 +08:00
committed by GitHub
parent fd676efea2
commit 4583ed246f
2 changed files with 16 additions and 2 deletions
+7 -2
View File
@@ -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");
}
+9
View File
@@ -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"]);
});