The swiss army knife of lossless video/audio editing
Make release-notes robust to Changelog placement
Claude07c5ad391c0b
diff --git a/AGENTS.md b/AGENTS.mdindex 2d0d576d..e96eb48b 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -2,7 +2,7 @@## Commits-If a commit changes user-visible behaviour (a fix, feature, or behaviour change a user would notice), add a `Changelog:` trailer to the commit message, describing the impact for users in one line. Omit it for internal changes (refactors, tests, CI, dependency bumps).+If a commit changes user-visible behaviour (a fix, feature, or behaviour change a user would notice), add a `Changelog:` line to the end of the commit message (e.g. with the other trailers), describing the impact for users in one line. Omit it for internal changes (refactors, tests, CI, dependency bumps).```Validate --settings-json with zoddiff --git a/script/releaseNotes.ts b/script/releaseNotes.tsindex ddd72f20..3b4e9b0f 100644--- a/script/releaseNotes.ts+++ b/script/releaseNotes.ts@@ -1,13 +1,12 @@-// Collects `Changelog:` commit trailers (see AGENTS.md) since the last tag, or since the ref given as argument.+// Collects `Changelog:` lines (see AGENTS.md) from commit messages since the last release tag, or since the ref given as argument.// Usage: yarn release-notes [from-ref]-import { execFile } from 'node:child_process';-import { promisify } from 'node:util';+import { execa } from 'execa';-const git = async (...args: string[]) => (await promisify(execFile)('git', args)).stdout.trim();+const from = process.argv[2] ?? (await execa('git', ['describe', '--tags', '--abbrev=0', '--match', 'v*'])).stdout.trim();-const from = process.argv[2] ?? await git('describe', '--tags', '--abbrev=0');--const log = await git('log', '--reverse', '--format=%(trailers:key=Changelog,valueonly,unfold)', `${from}..HEAD`);+// Match anywhere in the message, not just git's trailer block (which is only the last paragraph)+const { stdout } = await execa('git', ['log', '--reverse', '--format=%B', `${from}..HEAD`]);+const notes = [...stdout.matchAll(/^changelog\s*:\s*(.+)$/gim)].map(([, note]) => note!.trim());console.log(`Changes since ${from}:\n`);-log.split('\n').filter((line) => line.trim() !== '').forEach((line) => console.log(`- ${line.trim()}`));+console.log(notes.length > 0 ? notes.map((note) => `- ${note}`).join('\n') : '(none found)');