Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

feat(release): add optional contributor acknowledgments

tianma-if23a23f373633
diff --git a/docs/release.md b/docs/release.md
index cb9fa134..edc2ca5d 100644
--- a/docs/release.md
+++ b/docs/release.md
@@ -39,7 +39,26 @@ non-user-facing commit with a concrete reason:
The coverage audit runs before any local or GitHub mutation. Its mapping is
stored in the tracking Issue, not in the public Release notes. Public notes
-contain only user-visible changes, impact, and necessary migration guidance.
+contain user-visible changes, impact, necessary migration guidance, and optional
+contributor acknowledgments.
+
+To thank contributors to this version, optionally append one `--contributor`
+per GitHub username to the release command:
+
+```bash
+--contributor alice --contributor "@bob"
+```
+
+Review the list before publishing. Include code, translation, documentation, or
+issue-reporting contributions that helped this version; omit bots and avoid
+repeating the maintainer by default. Usernames may include a leading `@` and
+are deduplicated without regard to case, preserving the first spelling and order.
+The script appends `贡献者 / Contributors:@alice @bob` after the bilingual notes;
+omitting the option leaves the notes unchanged. GitHub uses the mentions to
+display its native Contributors avatar list. No accounts are inferred from commits
+or checked against GitHub. Preview the text with `--dry-run`. Resuming an existing
+Draft preserves its notes; edit that Draft directly if its acknowledgments need
+correction before publishing.
Use `--dry-run` to inspect commit coverage, the native rebuild plan, and notes.
After publication, the command does not download, install, or launch the macOS
diff --git a/docs/release.zh-CN.md b/docs/release.zh-CN.md
index 5baf96f0..64c9421c 100644
--- a/docs/release.zh-CN.md
+++ b/docs/release.zh-CN.md
@@ -38,7 +38,23 @@ bun run release -- \
```
覆盖审计在修改本地或 GitHub 状态之前执行。映射记录在跟踪 Issue 中,不写入
-公开 Release 说明。公开说明只包含用户可感知的变化、影响和必要的迁移提醒。
+公开 Release 说明。公开说明包含用户可感知的变化、影响、必要的迁移提醒,以及
+可选的贡献者致谢。
+
+如需感谢本次版本的贡献者,可在发布命令中按 GitHub 用户名逐个追加
+`--contributor`:
+
+```bash
+--contributor alice --contributor "@bob"
+```
+
+发布前人工核对名单,可包括帮助本次版本的代码、翻译、文档贡献者或问题报告者;
+排除机器人,默认不重复列出维护者。用户名可带开头的 `@`,忽略大小写去重,保留
+首次填写的拼写和顺序。脚本在双语说明末尾追加
+`贡献者 / Contributors:@alice @bob`;不传参数时说明保持原样。GitHub 根据这些
+提及展示原生 Contributors 头像列表。脚本不会从提交推断名单,也不会向 GitHub
+核验账号。使用 `--dry-run` 预览文本。续跑已有 Draft 时保留其原有说明;若需修正
+致谢,请在发布前直接编辑该 Draft。
使用 `--dry-run` 查看提交覆盖、原生端重建计划和说明。发布完成后不会下载、
安装或启动 macOS 应用;已安装的 macOS、Windows 与 Linux 桌面端通过应用内自动
diff --git a/scripts/release.mjs b/scripts/release.mjs
index be8f5d6c..d316a5fd 100644
--- a/scripts/release.mjs
+++ b/scripts/release.mjs
@@ -84,6 +84,7 @@ Options:
--change-locale <tag:text> Required Japanese bullet as ja: or ja-JP:; other locales optional
--change-commit <sha,...> Commits covered by the corresponding bilingual bullet
--ignore-commit <sha:why> Explicitly exclude a non-user-facing commit; may be repeated
+ --contributor <username> Credit a contributor to this release; optional, may be repeated
--install-desktop Install and launch the final DMG after publication
--dry-run Print the plan and generated notes without mutations
--help Show this help
@@ -100,6 +101,7 @@ export const parseReleaseArgs = (argv) => {
localizedChanges: [],
changeCommits: [],
ignoredCommits: [],
+ contributors: [],
installDesktop: false,
dryRun: false,
help: false,
@@ -115,6 +117,7 @@ export const parseReleaseArgs = (argv) => {
["--change-locale", "localizedChanges"],
["--change-commit", "changeCommits"],
["--ignore-commit", "ignoredCommits"],
+ ["--contributor", "contributors"],
]);
for (let index = 0; index < argv.length; index += 1) {
@@ -196,9 +199,23 @@ export const parseReleaseArgs = (argv) => {
);
}
options.localizedChanges = localizedChanges;
+ options.contributors = normalizeContributors(options.contributors);
return options;
};
+const normalizeContributors = (contributors) => {
+ const unique = new Map();
+ for (const value of contributors) {
+ const username = value.trim().replace(/^@/, "");
+ if (!/^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}$/i.test(username)) {
+ throw new Error(`Invalid --contributor GitHub username: ${value}`);
+ }
+ const key = username.toLowerCase();
+ if (!unique.has(key)) unique.set(key, username);
+ }
+ return [...unique.values()];
+};
+
const RELEASE_COMMIT_PATTERN = /^chore: release v\d+\.\d+\.\d+ \[skip ci\]$/;
const COMMIT_REF_PATTERN = /^[0-9a-f]{7,40}$/i;
@@ -391,6 +408,7 @@ export const buildReleaseNotes = ({
changesEn,
changesZh,
issueNumber,
+ contributors = [],
}) => [
"## 主要更新",
"",
@@ -404,6 +422,10 @@ export const buildReleaseNotes = ({
"",
`Related Issue: #${issueNumber}`,
"",
+ ...(contributors.length ? [
+ `贡献者 / Contributors:${normalizeContributors(contributors).map((username) => `@${username}`).join(" ")}`,
+ "",
+ ] : []),
].join("\n");
export const buildReleaseSummary = ({ version, changesEn, changesZh, localizedChanges = {} }) => ({
@@ -1526,6 +1548,7 @@ const releaseMain = async (options) => {
changesZh: options.changesZh,
localizedChanges: options.localizedChanges,
issueNumber: 0,
+ contributors: options.contributors,
}));
return;
}
@@ -1587,6 +1610,7 @@ const releaseMain = async (options) => {
changesEn: options.changesEn,
changesZh: options.changesZh,
issueNumber,
+ contributors: options.contributors,
});
const draftUrl = run("gh", [
"release",
diff --git a/scripts/release.test.mjs b/scripts/release.test.mjs
index 2e695375..835e940c 100644
--- a/scripts/release.test.mjs
+++ b/scripts/release.test.mjs
@@ -343,6 +343,31 @@ describe("release automation", () => {
])).toMatchObject({ installDesktop: true });
});
+ test("accepts optional contributors and deduplicates GitHub usernames", () => {
+ const args = [
+ "--issue-title", "Release",
+ "--bump", "patch",
+ "--label", "maintenance",
+ "--change-en", "Update the release flow.",
+ "--change-zh", "更新发布流程。",
+ "--change-locale", "ja:リリースフローを更新します。",
+ "--change-commit", "abc1234",
+ ];
+ expect(parseReleaseArgs(args).contributors).toEqual([]);
+ expect(parseReleaseArgs([
+ ...args,
+ "--contributor", " @Alice ",
+ "--contributor", "alice",
+ "--contributor", "bob-smith",
+ ]).contributors).toEqual(["Alice", "bob-smith"]);
+ for (const username of ["alice,bob", "https://github.com/alice", "@@alice", "-alice", "alice-", "a--b", "a".repeat(40), "alice\n@bob", "bot[bot]"]) {
+ expect(() => parseReleaseArgs([...args, "--contributor", username]))
+ .toThrow("Invalid --contributor GitHub username");
+ }
+ expect(() => parseReleaseArgs([...args, "--contributor"]))
+ .toThrow("--contributor requires a value");
+ });
+
test("requires Japanese App Store What's New", () => {
expect(() =>
parseReleaseArgs([
@@ -501,6 +526,7 @@ describe("release automation", () => {
expect(notes.indexOf("优化发布流程。"))
.toBeLessThan(notes.indexOf("Improve the release flow."));
expect(notes).not.toContain("## Verification");
+ expect(notes).not.toContain("Contributors");
expect(notes).not.toContain("## 验证");
expect(notes).not.toContain("bun run");
expect(notes).not.toContain("Version bump");
@@ -508,6 +534,22 @@ describe("release automation", () => {
expect(notes).not.toContain("\\n");
});
+ test("appends manually selected contributors after unchanged bilingual notes", () => {
+ const options = {
+ changesEn: ["Improve the release flow."],
+ changesZh: ["优化发布流程。"],
+ issueNumber: 126,
+ };
+ const original = buildReleaseNotes(options);
+ expect(buildReleaseNotes({ ...options, contributors: [] })).toBe(original);
+ expect(buildReleaseNotes({
+ ...options,
+ contributors: ["@Alice", "alice", "bob-smith"],
+ })).toBe(`${original}\n贡献者 / Contributors:@Alice @bob-smith\n`);
+ expect(() => buildReleaseNotes({ ...options, contributors: ["alice\n@bob"] }))
+ .toThrow("Invalid --contributor GitHub username");
+ });
+
test("builds the in-app summary from the same bilingual release changes", () => {
expect(buildReleaseSummary({
version: "1.6.55",