AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
fix(release): close resolved issues after audited publication (#770)
tianma-iff8b5b7649b19
diff --git a/docs/release.md b/docs/release.mdindex 32a32ca1..6a55c9aa 100644--- a/docs/release.md+++ b/docs/release.md@@ -19,10 +19,11 @@ bun run release -- \--change-en "Run required release checks in parallel." \--change-zh "并行执行发布所需检查。" \--change-locale "ja:必要なリリースチェックを並列実行します。" \- --change-commit "abcdef1"+ --change-commit "abcdef1" \+ --change-issue "123:en"```-Repeat `--change-en`, `--change-zh`, `--change-locale ja:`, and `--change-commit` as matching groups.+Repeat `--change-en`, `--change-zh`, `--change-locale ja:`, `--change-commit`, and `--change-issue` as matching groups.Japanese What's New is required because the App Store listing includes Japanese.One change may cover multiple comma-separated commits:@@ -41,6 +42,37 @@ The coverage audit runs before any local or GitHub mutation; its mapping isstored in the tracking Issue. Use `--dry-run` to preview commit coverage, thenative rebuild plan, and Release notes.+### Automatic Follow-up for Resolved Issues++Each change requires `--change-issue "123:en,456:zh"` to declare fully resolved+Issues in the release repository and the discussion language: `en` for English,+`zh` for Chinese, and `en` for mixed discussions. Use `--change-issue none` when+there is no resolved Issue. PR numbers are rejected. Do not list merely related+or partially implemented Issues; the script never infers closure from arbitrary+`#number` mentions.++`--dry-run` validates and displays the targets. The tracking Issue and release+checkpoint retain the mapping, and Release notes automatically link these Issues.+Resume a Draft with the same declarations. After all blocking post-publication+desktop, Android, and GHCR audits pass, the script backlinks the Release in the+selected language, then closes each still-open target. Already-closed Issues get+a backlink while retaining their closure reason. Non-blocking iOS delivery,+Demo deployment, and TCR jobs do not gate this follow-up.++A failed backlink prevents that Issue from closing; other targets still proceed.+Partial failures retain the published Release and leave the tracking Issue open,+with an independent retry command:++```bash+bun run release -- --finish-issues vX.Y.Z+```++This command restores the saved plan and successful-audit receipt and only handles+Issues; it does not republish or rebuild assets. Repeated runs do not duplicate+backlinks. Missing plans or audit receipts, a different target commit, or a Release+restored to Draft prevent closure. Add `--dry-run` to inspect the plan. Older+releases without these records cannot use this entry point.+### External Contributor Credits- Changes completed by the maintainer need no attribution. Credit externaldiff --git a/docs/release.zh-CN.md b/docs/release.zh-CN.mdindex ca15239d..03bba235 100644--- a/docs/release.zh-CN.md+++ b/docs/release.zh-CN.md@@ -19,11 +19,12 @@ bun run release -- \--change-en "Run required release checks in parallel." \--change-zh "并行执行发布所需检查。" \--change-locale "ja:必要なリリースチェックを並列実行します。" \- --change-commit "abcdef1"+ --change-commit "abcdef1" \+ --change-issue "123:en"```多项变化需要按组重复传入 `--change-en`、`--change-zh`、-`--change-locale ja:` 和 `--change-commit`。App Store 列表含日文,因此必须提供+`--change-locale ja:`、`--change-commit` 和 `--change-issue`。App Store 列表含日文,因此必须提供日文 What’s New。一项变化可以关联多个以逗号分隔的提交:```bash@@ -40,6 +41,30 @@ bun run release -- \覆盖审计在修改本地或 GitHub 状态之前执行,映射记录在跟踪 Issue 中。使用 `--dry-run` 预览提交覆盖、原生端重建计划和 Release 说明。+### 已解决 Issue 的自动收尾++每条变化必须同时传入 `--change-issue "123:en,456:zh"`,声明本次已完整解决的+同仓库 Issue 及回复语言;英文讨论使用 `en`,中文使用 `zh`,中英混合默认 `en`。+没有已解决 Issue 时必须显式传入 `--change-issue none`。PR 编号不能用作关闭目标;+仅相关或部分实现的 Issue 不应列入。脚本不会从任意 `#编号` 推断关闭目标。++`--dry-run` 会核查并显示目标。映射保存在跟踪 Issue 和发布检查点中,Release+说明自动关联这些 Issue;续跑 Draft 必须使用相同的声明。发布后的桌面、Android+和 GHCR 阻塞审计全部通过后,脚本先按声明语言回链 Release,再关闭仍处于打开+状态的目标 Issue。已关闭的 Issue 只补回链,保留原关闭原因。iOS 商店交付、Demo+及 TCR 等非阻塞任务不影响此收尾条件。++回链失败时不会关闭对应 Issue;其他目标仍会继续处理。部分失败会保留正式+Release 和未关闭的跟踪 Issue,并输出独立续跑命令:++```bash+bun run release -- --finish-issues vX.Y.Z+```++该命令从已保存的计划和成功审计记录恢复,仅处理 Issue,不重新发布或构建资产。+重复执行不会重复回链;缺少计划、成功审计记录、目标提交不一致或 Release 已恢复+Draft 时拒绝关闭。可加 `--dry-run` 只查看计划。旧发布没有这些记录时不能使用此入口。+### 外部贡献者署名- 维护者本人完成的内容无需署名;外部贡献在对应条目末尾注明 `@username` 和 PR。diff --git a/package.json b/package.jsonindex ba09bdec..b402722a 100644--- a/package.json+++ b/package.json@@ -62,7 +62,7 @@"benchmark:desktop:sidecar": "bun scripts/benchmark-desktop-sidecar.mjs","verify:web-performance": "bun scripts/verify-web-performance.mjs","verify:web-startup": "bun scripts/verify-web-startup-browser.mjs",- "test:release-planning": "bun test scripts/plan-native-release.test.mjs scripts/check-native-release-assets.test.mjs scripts/create-mac-update-metadata.test.mjs scripts/windows-update-metadata.test.mjs scripts/linux-update-release.test.mjs scripts/desktop-build-workflow.test.mjs scripts/pe-imports.test.mjs scripts/report-native-build-timings.test.mjs scripts/release.test.mjs scripts/sync-readme-contributors.test.mjs scripts/validate-store-delivery.test.mjs scripts/store-delivery.test.mjs scripts/xcode-cloud-control.test.mjs scripts/download-play-universal-apk.test.mjs scripts/verify-android-apk-signature.test.mjs scripts/desktop-icns.test.mjs scripts/verify-desktop-cross-version-startup.test.mjs scripts/preview-macos-dock-icon.test.mjs apps/web/src/lib/version-check.test.mjs apps/mobile/src/lib/mobile-release.test.ts",+ "test:release-planning": "bun test scripts/plan-native-release.test.mjs scripts/check-native-release-assets.test.mjs scripts/create-mac-update-metadata.test.mjs scripts/windows-update-metadata.test.mjs scripts/linux-update-release.test.mjs scripts/desktop-build-workflow.test.mjs scripts/pe-imports.test.mjs scripts/report-native-build-timings.test.mjs scripts/release.test.mjs scripts/release-issues.test.mjs scripts/sync-readme-contributors.test.mjs scripts/validate-store-delivery.test.mjs scripts/store-delivery.test.mjs scripts/xcode-cloud-control.test.mjs scripts/download-play-universal-apk.test.mjs scripts/verify-android-apk-signature.test.mjs scripts/desktop-icns.test.mjs scripts/verify-desktop-cross-version-startup.test.mjs scripts/preview-macos-dock-icon.test.mjs apps/web/src/lib/version-check.test.mjs apps/mobile/src/lib/mobile-release.test.ts","sync:contributors": "bun scripts/sync-readme-contributors.mjs","release": "bun scripts/release.mjs","publish:stores": "bun scripts/store-delivery.mjs",diff --git a/scripts/release-issues.mjs b/scripts/release-issues.mjsnew file mode 100644index 00000000..564bfec7--- /dev/null+++ b/scripts/release-issues.mjs@@ -0,0 +1,64 @@+/** Every change must explicitly declare resolved issues, or opt out with `none`. */+export const parseChangeIssues = (values, changeCount) => {+ if (values.length !== changeCount) {+ throw new Error('Each change requires --change-issue "<number>:en|zh,..." or --change-issue none.');+ }+ const issues = new Map();+ for (const value of values) {+ if (value === "none") continue;+ for (const entry of value.split(",")) {+ const match = entry.trim().match(/^([1-9]\d*):(en|zh)$/);+ if (!match || !Number.isSafeInteger(Number(match[1]))) {+ throw new Error(`Invalid --change-issue: ${entry}; use <number>:en|zh or none.`);+ }+ const number = Number(match[1]);+ const language = match[2];+ if (issues.has(number) && issues.get(number).language !== language) {+ throw new Error(`Conflicting comment languages for Issue #${number}.`);+ }+ issues.set(number, { number, language });+ }+ }+ return [...issues.values()].sort((a, b) => a.number - b.number);+};++export const validateResolvedIssues = (issues, getIssue) => {+ for (const { number } of issues) {+ const issue = getIssue(number);+ if (issue.number !== number || issue.pull_request) {+ throw new Error(`#${number} must be an Issue in the release repository, not a PR.`);+ }+ }+};++export const issueReleaseComment = ({ tag, url, language }) => {+ const marker = `<!-- edgeever-release-issue:${tag} -->`;+ return `${marker}\n${language === "zh"+ ? `本问题已在 [${tag}](${url}) 发布,发布后的必要审计已通过。`+ : `Released in [${tag}](${url}). Required post-publication audits passed.`}`;+};++/** A durable successful-audit receipt is required, including on a retry. */+export const finishResolvedIssues = ({ release, auditedSha, issues, client }) => {+ if (release.isDraft || release.isPrerelease || !auditedSha || auditedSha !== release.targetCommitish) {+ throw new Error("Issue completion requires a published stable Release with successful audits for its target commit.");+ }+ validateResolvedIssues(issues, client.getIssue);+ const failures = [];+ for (const issue of issues) {+ try {+ const body = issueReleaseComment({ tag: release.tagName, url: release.url, language: issue.language });+ // Read all pages: a retry must not duplicate a backlink on a long discussion.+ if (!client.listComments(issue.number).some((comment) => comment.body === body)) {+ client.comment(issue.number, body);+ }+ // Never close without a successful backlink; preserve already-closed reasons.+ if (client.getIssue(issue.number).state === "open") client.close(issue.number);+ } catch (error) {+ failures.push(`#${issue.number}: ${error.message}`);+ }+ }+ if (failures.length) {+ throw new Error(`Issue follow-up failed (${failures.join("; ")}). Retry: bun run release -- --finish-issues ${release.tagName}`);+ }+};diff --git a/scripts/release-issues.test.mjs b/scripts/release-issues.test.mjsnew file mode 100644index 00000000..49d717fd--- /dev/null+++ b/scripts/release-issues.test.mjs@@ -0,0 +1,84 @@+import { describe, expect, test } from "bun:test";+import { parseReleaseArgs } from "./release.mjs";+import { parseChangeIssues, finishResolvedIssues, validateResolvedIssues } from "./release-issues.mjs";++const release = { tagName: "v2.19.0", url: "https://github.com/tianma-if/edgeever/releases/tag/v2.19.0", targetCommitish: "abc123", isDraft: false, isPrerelease: false };+const issues = [{ number: 767, language: "en" }, { number: 751, language: "zh" }];+const fixture = () => {+ const records = new Map(issues.map(({ number }) => [number, { number, state: "open", comments: [] }]));+ const calls = [];+ const client = {+ getIssue: (number) => records.get(number),+ listComments: (number) => records.get(number).comments,+ comment: (number, body) => { calls.push(["comment", number]); records.get(number).comments.push({ body }); },+ close: (number) => { calls.push(["close", number]); records.get(number).state = "closed"; },+ };+ return { records, calls, client };+};+const finish = (f, overrides = {}) => finishResolvedIssues({ release, auditedSha: "abc123", issues, client: f.client, ...overrides });++describe("release Issue follow-up", () => {+ test("requires an explicit per-change declaration and rejects PRs and conflicting languages", () => {+ expect(() => parseChangeIssues([], 1)).toThrow("Each change requires");+ expect(parseChangeIssues(["767:en,751:zh", "767:en", "none"], 3)).toEqual([issues[1], issues[0]]);+ for (const value of ["0:en", "-1:en", "767", "767:fr", "other/repo#767:en", "none,767:en", "9007199254740992:en"]) {+ expect(() => parseChangeIssues([value], 1)).toThrow("Invalid");+ }+ expect(() => parseChangeIssues(["767:en,767:zh"], 1)).toThrow("Conflicting");+ expect(() => validateResolvedIssues(issues, (number) => ({ number, pull_request: {} }))).toThrow("not a PR");+ });++ test("CLI cannot omit Issue decisions, and supports a separate published-release retry", () => {+ const args = ["--bump", "patch", "--issue-title", "Fix", "--label", "bug", "--change-en", "Fix PDF", "--change-zh", "修复 PDF", "--change-locale", "ja:PDF を修正", "--change-commit", "abc1234"];+ expect(() => parseReleaseArgs(args)).toThrow("--change-issue");+ expect(parseReleaseArgs([...args, "--change-issue", "767:en"]).resolvedIssues).toEqual([issues[0]]);+ expect(parseReleaseArgs(["--finish-issues", "v2.19.0"])).toMatchObject({ finishIssues: "v2.19.0" });+ expect(() => parseReleaseArgs(["--finish-issues", "v2.19.0", "--bump", "patch"])).toThrow("only accepts");+ expect(() => parseReleaseArgs(["--finish-issues", "latest"])).toThrow("stable");+ });++ test("never mutates Issues for Drafts, prereleases, failed or stale audit receipts", () => {+ for (const overrides of [{ release: { ...release, isDraft: true } }, { release: { ...release, isPrerelease: true } }, { auditedSha: undefined }, { auditedSha: "old" }]) {+ const f = fixture();+ expect(() => finish(f, overrides)).toThrow("successful audits");+ expect(f.calls).toEqual([]);+ }+ });++ test("backlinks in the selected language before closing, without touching unrelated Issues", () => {+ const f = fixture();+ finish(f);+ expect(f.calls).toEqual([["comment", 767], ["close", 767], ["comment", 751], ["close", 751]]);+ expect(f.records.get(767).comments[0].body).toContain(`Released in [v2.19.0](${release.url})`);+ expect(f.records.get(751).comments[0].body).toContain(`本问题已在 [v2.19.0](${release.url}) 发布`);+ finish(f);+ expect(f.calls).toHaveLength(4);+ });++ test("a comment failure keeps its Issue open, finishes other Issues, and can be retried", () => {+ const f = fixture();+ const comment = f.client.comment;+ f.client.comment = (number, body) => { if (number === 767) throw new Error("network"); comment(number, body); };+ expect(() => finish(f)).toThrow("--finish-issues v2.19.0");+ expect(f.records.get(767).state).toBe("open");+ expect(f.records.get(751).state).toBe("closed");+ f.client.comment = comment;+ finish(f);+ expect(f.records.get(767).state).toBe("closed");+ expect(f.records.get(751).comments).toHaveLength(1);+ });++ test("retry after a close failure reuses the backlink and preserves already-closed reasons", () => {+ const f = fixture();+ const close = f.client.close;+ f.client.close = () => { throw new Error("network"); };+ expect(() => finish(f)).toThrow("--finish-issues");+ f.client.close = close;+ f.records.get(751).state = "closed";+ f.records.get(751).state_reason = "not_planned";+ finish(f);+ expect(f.records.get(767).comments).toHaveLength(1);+ expect(f.records.get(751).state_reason).toBe("not_planned");+ expect(f.calls.filter(([action]) => action === "close")).toEqual([["close", 767]]);+ });+});diff --git a/scripts/release.mjs b/scripts/release.mjsindex 9865fd3a..212d642f 100644--- a/scripts/release.mjs+++ b/scripts/release.mjs@@ -1,3 +1,4 @@+import { parseChangeIssues, validateResolvedIssues, finishResolvedIssues } from "./release-issues.mjs";import {createHash,} from "node:crypto";@@ -49,6 +50,7 @@ export const RELEASE_VALIDATIONS = ["scripts/check-native-release-assets.test.mjs","scripts/windows-update-metadata.test.mjs","scripts/release.test.mjs",+ "scripts/release-issues.test.mjs","scripts/sync-readme-contributors.test.mjs","scripts/validate-store-delivery.test.mjs","scripts/store-delivery.test.mjs",@@ -70,9 +72,10 @@ const usage = `Usage:--change-en "English user-facing change" \\--change-zh "中文用户更新说明" \\--change-locale "ja:日本語のユーザー向け説明" \\- --change-commit "abcdef1"+ --change-commit "abcdef1" \\+ --change-issue "123:en"-Repeat --change-en, --change-zh, --change-locale ja:, and --change-commit for multiple paired release bullets.+Repeat --change-en, --change-zh, --change-locale ja:, --change-commit, and --change-issue for multiple paired release bullets.Use comma-separated SHAs when one bullet covers multiple commits. Every othercommit requires --ignore-commit "abcdef1:reason".@@ -84,6 +87,8 @@ Options:--change-en <text> Required English release bullet; may be repeated--change-zh <text> Required Chinese release bullet; may be repeated--change-locale <tag:text> Required Japanese bullet as ja: or ja-JP:; other locales optional+ --change-issue <ids> Required per change: resolved Issue numbers with en/zh language (123:en,456:zh), or none+ --finish-issues <tag> Retry Issue follow-up for an already published, audited Release--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@@ -102,6 +107,8 @@ export const parseReleaseArgs = (argv) => {changesZh: [],localizedChanges: [],changeCommits: [],+ changeIssues: [],+ finishIssues: "",ignoredCommits: [],contributors: [],installDesktop: false,@@ -118,6 +125,8 @@ export const parseReleaseArgs = (argv) => {["--change-zh", "changesZh"],["--change-locale", "localizedChanges"],["--change-commit", "changeCommits"],+ ["--change-issue", "changeIssues"],+ ["--finish-issues", "finishIssues"],["--ignore-commit", "ignoredCommits"],["--contributor", "contributors"],]);@@ -159,6 +168,13 @@ export const parseReleaseArgs = (argv) => {if (!/^[^/\s]+\/[^/\s]+$/.test(options.repository)) {throw new Error("--repository must use owner/name format.");}+ if (options.finishIssues) {+ buildReleaseTitle(options.finishIssues);+ if (argv.some((arg) => arg.startsWith("--") && !["--finish-issues", "--repository", "--dry-run"].includes(arg))) {+ throw new Error("--finish-issues only accepts --repository and --dry-run.");+ }+ return options;+ }if (!VERSION_BUMPS.has(options.bump)) {throw new Error("--bump must be patch, minor, or major.");}@@ -200,6 +216,7 @@ export const parseReleaseArgs = (argv) => {"--change-locale ja is required because the App Store listing includes Japanese What's New.",);}+ options.resolvedIssues = parseChangeIssues(options.changeIssues, options.changesEn.length);options.localizedChanges = localizedChanges;options.contributors = normalizeContributors(options.contributors);return options;@@ -379,7 +396,7 @@ export const buildReleaseTitle = (tag) => {return tag;};-export const buildIssueBody = ({ changesEn, changesZh, commitCoverageAudit }) => [+export const buildIssueBody = ({ changesEn, changesZh, commitCoverageAudit, changeIssues = [] }) => ["## Summary","",...changesEn.map((change) => `- ${change}`),@@ -399,6 +416,7 @@ export const buildIssueBody = ({ changesEn, changesZh, commitCoverageAudit }) =>),"",] : []),+ ...(changeIssues.length ? ["## Resolved Issues per change", "", ...changeIssues.map((issues, index) => `- Change ${index + 1}: ${issues}`), ""] : []),"## Acceptance criteria","","- Required type checks, Web build, and native release planning tests pass.",@@ -411,18 +429,19 @@ export const buildReleaseNotes = ({changesZh,issueNumber,contributors = [],+ resolvedIssues = [],}) => ["## 主要更新","",...changesZh.map((change) => `- ${change}`),"",- `关联 Issue:#${issueNumber}`,+ `关联 Issue:${[issueNumber, ...resolvedIssues.map((issue) => issue.number)].map((number) => `#${number}`).join(", ")}`,"","## Key Changes","",...changesEn.map((change) => `- ${change}`),"",- `Related Issue: #${issueNumber}`,+ `Related Issue: ${[issueNumber, ...resolvedIssues.map((issue) => issue.number)].map((number) => `#${number}`).join(", ")}`,"",...(contributors.length ? [`贡献者 / Contributors:${normalizeContributors(contributors).map((username) => `@${username}`).join(" ")}`,@@ -1489,6 +1508,28 @@ export const installReleaseDmg = async ({ repository, tag }) => {await installPublishedDmg({ repository, tag, assets: published.assets });};+const issueClient = (repository) => ({+ getIssue: (number) => ghJson(["api", `repos/${repository}/issues/${number}`]),+ listComments: (number) => ghJson(["api", "--paginate", "--slurp", `repos/${repository}/issues/${number}/comments?per_page=100`]).flat(),+ comment: (number, body) => run("gh", ["api", "--method", "POST", `repos/${repository}/issues/${number}/comments`, "--raw-field", `body=${body}`], { capture: true }),+ close: (number) => run("gh", ["api", "--method", "PATCH", `repos/${repository}/issues/${number}`, "--raw-field", "state=closed", "--raw-field", "state_reason=completed"], { capture: true }),+});++const retryReleaseIssues = (options) => {+ const release = ghJson(["release", "view", options.finishIssues, "--repo", options.repository, "--json", "tagName,isDraft,isPrerelease,targetCommitish,body,url"]);+ const issueNumber = Number(release.body.match(/Related Issue: #(\d+)/)?.[1]);+ if (!issueNumber) throw new Error("Release notes do not identify a tracking Issue.");+ const { state } = loadReleaseCheckpoint({ repository: options.repository, issueNumber, tag: release.tagName });+ if (!Array.isArray(state.resolvedIssues)) throw new Error("No saved resolved-Issue plan exists for this Release.");+ if (options.dryRun) {+ console.log(JSON.stringify({ tag: release.tagName, resolvedIssues: state.resolvedIssues, auditedSha: state.issueAuditedSha ?? null }));+ return;+ }+ const client = issueClient(options.repository);+ finishResolvedIssues({ release, auditedSha: state.issueAuditedSha, issues: state.resolvedIssues, client });+ finishResolvedIssues({ release, auditedSha: state.issueAuditedSha, issues: [{ number: issueNumber, language: "en" }], client });+};+const releaseMain = async (options) => {const latestRelease = ghJson(["api",@@ -1552,6 +1593,8 @@ const releaseMain = async (options) => {ignoredCommits: options.ignoredCommits,});printReleaseCoverageAudit({ audit: commitCoverageAudit, changesEn: options.changesEn });+ validateResolvedIssues(options.resolvedIssues, issueClient(options.repository).getIssue);+ console.log(`[release] resolved Issues: ${JSON.stringify(options.resolvedIssues)}`);const desktopPlan = planNativeRelease("desktop", changedFiles);const mobilePlan = planNativeRelease("mobile", changedFiles);const iosPlan = planNativeRelease("ios", changedFiles);@@ -1568,6 +1611,7 @@ const releaseMain = async (options) => {localizedChanges: options.localizedChanges,issueNumber: 0,contributors: options.contributors,+ resolvedIssues: options.resolvedIssues,}));return;}@@ -1632,6 +1676,7 @@ const releaseMain = async (options) => {changesZh: options.changesZh,issueNumber,contributors: options.contributors,+ resolvedIssues: options.resolvedIssues,});const draftUrl = run("gh", ["release",@@ -1655,6 +1700,9 @@ const releaseMain = async (options) => {issueNumber,tag,});+ if (storedCheckpoint.state.resolvedIssues && JSON.stringify(storedCheckpoint.state.resolvedIssues) !== JSON.stringify(options.resolvedIssues)) {+ throw new Error("Resolved-Issue plan differs from the saved Draft plan. Resume with the original --change-issue values.");+ }let checkpointCommentId = storedCheckpoint.commentId;const priorReleaseSha = storedCheckpoint.state.releaseSha;const preserveIosStoreRun = Boolean(@@ -1688,6 +1736,7 @@ const releaseMain = async (options) => {state: checkpoint,});};+ checkpoint.resolvedIssues = options.resolvedIssues;persistCheckpoint();let playDeliveryAction = "upload";@@ -1929,18 +1978,15 @@ const releaseMain = async (options) => {throw error;}- const releaseComment = run("gh", [- "issue",- "comment",- String(issueNumber),- "--repo",- options.repository,- "--body",- `Released in [${tag}](${releaseUrl}).\n\nRequired local validations, Draft asset and image preparation, and post-publication audits passed.`,- ], { allowFailure: true });- if (releaseComment.status !== 0) {- console.warn(`[release] failed to comment on Issue #${issueNumber} before closing it`);- }+ checkpoint.issueAuditedSha = releaseSha;+ persistCheckpoint();+ finishResolvedIssues({+ release: ghJson(["release", "view", tag, "--repo", options.repository, "--json", "tagName,url,isDraft,isPrerelease,targetCommitish"]),+ auditedSha: checkpoint.issueAuditedSha,+ issues: checkpoint.resolvedIssues,+ client: issueClient(options.repository),+ });+const timingStoreRunId =checkpoint.storeRecoveryRunId ??checkpoint.storeRunId ??@@ -1988,15 +2034,12 @@ const releaseMain = async (options) => {} else {console.warn("[release] failed to dispatch the non-blocking endpoint timing report");}- run("gh", [- "issue",- "close",- String(issueNumber),- "--repo",- options.repository,- "--reason",- "completed",- ]);+ finishResolvedIssues({+ release: ghJson(["release", "view", tag, "--repo", options.repository, "--json", "tagName,url,isDraft,isPrerelease,targetCommitish"]),+ auditedSha: checkpoint.issueAuditedSha,+ issues: [{ number: issueNumber, language: "en" }],+ client: issueClient(options.repository),+ });console.log(`[release] closed Issue #${issueNumber}`);if (iosPlan.rebuild) {@@ -2030,6 +2073,8 @@ if (import.meta.main) {const options = parseReleaseArgs(process.argv.slice(2));if (options.help) {console.log(usage);+ } else if (options.finishIssues) {+ retryReleaseIssues(options);} else {await releaseMain(options);}diff --git a/scripts/release.test.mjs b/scripts/release.test.mjsindex 835e940c..ea7e08c3 100644--- a/scripts/release.test.mjs+++ b/scripts/release.test.mjs@@ -104,7 +104,7 @@ describe("release automation", () => {const publication = releaseSource.indexOf('"--draft=false"');const iosWait = releaseSource.indexOf('label: "App Store delivery"');const restoreDraft = releaseSource.lastIndexOf('"--draft=true"');- const issueClose = releaseSource.indexOf('"issue",\n "close"', publication);+ const issueClose = releaseSource.indexOf("issues: [{ number: issueNumber", publication);expect(iosPlan).toBeGreaterThan(0);expect(iosDispatch).toBeGreaterThan(iosPlan);@@ -309,6 +309,7 @@ describe("release automation", () => {"ja-JP:チェックを並列実行します。","--change-commit","abc1234",+ "--change-issue", "none",]),).toMatchObject({issueTitle: "Improve release flow",@@ -330,6 +331,7 @@ describe("release automation", () => {"--change-zh", "更新发布流程。","--change-locale", "ja:リリースフローを更新します。","--change-commit", "abc1234",+ "--change-issue", "none",])).toMatchObject({ installDesktop: false });expect(parseReleaseArgs(["--issue-title", "Release",@@ -339,6 +341,7 @@ describe("release automation", () => {"--change-zh", "更新发布流程。","--change-locale", "ja:リリースフローを更新します。","--change-commit", "abc1234",+ "--change-issue", "none","--install-desktop",])).toMatchObject({ installDesktop: true });});@@ -352,6 +355,7 @@ describe("release automation", () => {"--change-zh", "更新发布流程。","--change-locale", "ja:リリースフローを更新します。","--change-commit", "abc1234",+ "--change-issue", "none",];expect(parseReleaseArgs(args).contributors).toEqual([]);expect(parseReleaseArgs([@@ -383,6 +387,7 @@ describe("release automation", () => {"修复问题。","--change-commit","abc1234",+ "--change-issue", "none",]),).toThrow("--change-locale ja is required");});@@ -505,6 +510,7 @@ describe("release automation", () => {"修复问题。","--change-commit","abc1234",+ "--change-issue", "none",])).toThrow("--bump must be patch, minor, or major");});