docs(changelog): link problems using short redirects instead of issue URLs

This commit is contained in:
Prad Nukala committed 2026-09-30 18:02:19 -04:00
1 parent 4b8496c113
commit fd57f53d34
2 files changed
+20 -14

No files matched your search

+9 -12
View File
@@ -12,7 +12,9 @@
* release-topics.ts's render() writes: `| #issue | LC n · Name | set | diff |
* closed | [py](…) · [docs](…) |`. Only `### Closed …` sections are read, so
* a release published before open problems were dropped from the body still
* shows only what finished.
* shows only what finished. The row's own `[docs]` link is not used: it is
* frozen at release time (a problem solved before the docs existed has
* none), while the page links each problem by its LC number to its page now.
*
* Auth: GITHUB_TOKEN when set (deploy.yml passes it), else unauthenticated —
* one request per 100 releases fits the anonymous limit. A failed request
@@ -26,13 +28,13 @@ const KIND = /^(Topic|Review) \d+ — /u;
export interface ReleaseProblem {
issue: number;
/** The LeetCode number, the key of the docs `/<num>` short links. */
lc: number;
/** `LC 57 · Insert Interval`. */
title: string;
set: string;
/** `easy` / `medium` / `hard`, the problem's `diff:*` label. */
difficulty: string;
/** The problem's `/<num>` docs short link, once it has a page. */
docs?: string;
}
export interface Release {
@@ -53,15 +55,10 @@ function closedProblems(body: string): ReleaseProblem[] {
for (const line of body.split("\n")) {
if (line.startsWith("### ")) closed = line.startsWith("### Closed");
if (!closed || !line.startsWith("| #")) continue;
const [issue, title, set, difficulty, , solution] = line.slice(1, -1).split("|").map((cell) => cell.trim());
if (!issue || !title || !set || !difficulty) continue;
problems.push({
issue: Number(issue.slice(1)),
title,
set,
difficulty,
docs: solution?.match(/\[docs\]\(([^)]+)\)/u)?.[1],
});
const [issue, title, set, difficulty] = line.slice(1, -1).split("|").map((cell) => cell.trim());
const lc = title?.match(/^LC (\d+) · /u)?.[1];
if (!issue || !title || !lc || !set || !difficulty) continue;
problems.push({ issue: Number(issue.slice(1)), lc: Number(lc), title, set, difficulty });
}
return problems;
}