Check the changelog section of pull request descriptions in CI

Ports the clusterio versions of the changelog scripts. pr_to_changelog.mts
gains the Contributors and Statistics blocks and a shared
checkPullRequestBody, which check_pr_changelog.mts runs on every pull
request through the new Changelog workflow. The latest release is now the
newest one targeting main. Adds the pull request template the check
expects, and node --test runs the script tests in Node.js CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-11-19 14:32:21 +00:00
1 parent b513b7a637
commit 3687a7a527
8 files changed
+305 -25

No files matched your search

+17 -2
View File
@@ -11,8 +11,8 @@ export async function githubFetch(
init = {
...init,
headers: {
...init.headers as Record<string, string> ?? {},
"Accept": "application/vnd.github+json",
...init.headers as Record<string, string> ?? {},
}
};
if (process.env.GH_TOKEN) {
@@ -24,7 +24,9 @@ export async function githubFetch(
console.log(response.headers);
throw new Error(`GitHub replied with ${response.status} ${response.statusText}: ${await response.text()}`);
}
if (!response.headers.get("Content-Type")?.startsWith("application/json")) {
const accept = init.headers!["Accept"];
const contentType = accept === "application/vnd.github+json" ? "application/json" : accept;
if (!response.headers.get("Content-Type")?.startsWith(contentType)) {
throw new Error(
`GitHub replied with ${response.status} ${response.statusText}: ${response.headers.get("Content-Type")}`
);
@@ -41,6 +43,15 @@ export async function githubFetchJson<T>(
return await response.json();
}
export async function githubFetchText(
path: string,
query: Record<string, string> = {},
init: RequestInit & { headers?: Record<string, string> } = {},
): Promise<string> {
const response = await githubFetch(path, query, init);
return await response.text();
}
export async function githubFetchJsonPaginated<T>(
path: string,
query: Record<string, string> = {},
@@ -117,6 +128,10 @@ export interface Release {
updated_at?: string | null,
}
export interface Comparison {
total_commits: number,
}
export interface Commit {
sha: string,
commit: {