ci: guard changelog bot attributions

This commit is contained in:
Peter Steinberger
2026-04-27 14:28:05 +01:00
parent 6e8aaef1cc
commit bbbc80ddcc
7 changed files with 92 additions and 8 deletions

View File

@@ -258,6 +258,7 @@ describe("scripts/changed-lanes", () => {
});
expect(plan.commands.map((command) => command.name)).toEqual([
"conflict markers",
"changelog attributions",
"typecheck core tests",
"lint core",
"lint scripts",
@@ -544,6 +545,7 @@ describe("scripts/changed-lanes", () => {
});
expect(plan.commands.map((command) => command.args[0])).toEqual([
"check:no-conflict-markers",
"check:changelog-attributions",
"release-metadata:check",
"ios:version:check",
"config:schema:check",
@@ -674,6 +676,7 @@ describe("scripts/changed-lanes", () => {
});
expect(plan.commands).toEqual([
{ name: "conflict markers", args: ["check:no-conflict-markers"] },
{ name: "changelog attributions", args: ["check:changelog-attributions"] },
]);
});
@@ -684,6 +687,7 @@ describe("scripts/changed-lanes", () => {
expect(result.docsOnly).toBe(true);
expect(plan.commands).toEqual([
{ name: "conflict markers", args: ["check:no-conflict-markers"] },
{ name: "changelog attributions", args: ["check:changelog-attributions"] },
]);
});
});

View File

@@ -0,0 +1,28 @@
import { describe, expect, it } from "vitest";
import { findForbiddenChangelogThanks } from "../../scripts/check-changelog-attributions.mjs";
describe("check-changelog-attributions", () => {
it("flags forbidden bot, org, and maintainer thanks attributions", () => {
const content = [
"- Internal cleanup. Thanks @codex.",
"- Org-owned fix. Thanks @openclaw.",
"- Maintainer-owned fix. Thanks @steipete.",
"- Mixed credit. Thanks @contributor and @OpenClaw.",
].join("\n");
expect(findForbiddenChangelogThanks(content)).toEqual([
{ line: 1, handle: "codex", text: "- Internal cleanup. Thanks @codex." },
{ line: 2, handle: "openclaw", text: "- Org-owned fix. Thanks @openclaw." },
{ line: 3, handle: "steipete", text: "- Maintainer-owned fix. Thanks @steipete." },
{ line: 4, handle: "openclaw", text: "- Mixed credit. Thanks @contributor and @OpenClaw." },
]);
});
it("allows external contributor thanks attributions", () => {
expect(
findForbiddenChangelogThanks(
"- User-facing fix. Fixes #123. Thanks @external-contributor and @other-user.",
),
).toEqual([]);
});
});