Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

ci(release-notes): leave PRs labelled no-release-notes out of the notes

review4427c8105789
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 9574ccbd2..f0e846605 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -297,6 +297,12 @@ jobs:
publish:
runs-on: ubuntu-latest
needs: [release-mac, release-linux]
+ # A job-level block replaces the workflow's, so contents: write is restated. issues: read lets
+ # the release-notes generator look up the PRs labelled `no-release-notes` (labels live on the
+ # issues API); without it that lookup fails and the notes fall back to the plain commit list.
+ permissions:
+ contents: write
+ issues: read
steps:
- uses: actions/checkout@v7
with:
@@ -308,7 +314,8 @@ jobs:
# Layer 1 scripts/release-notes.mjs asks GitHub's own generator for the PR-resolved
# list (PR number, PR title, author) and regroups it into New / Improved /
# Fixed, with test/refactor/chore/ci/build collapsed at the bottom — kept, not
- # deleted. Every entry links its PR, and any issue its title names.
+ # deleted. Every entry links its PR, and any issue its title names. A PR
+ # labelled `no-release-notes` is left out entirely (docs/release-notes/README.md).
# Layer 2 docs/release-notes/<TAG>.md, a hand-written Highlights block reviewed in the
# release PR, placed at the top. ABSENT FILE ⇒ THE GROUPED LIST ALONE. No
# release is ever blocked waiting for prose, and nobody has to be in the loop.
diff --git a/docs/release-notes/README.md b/docs/release-notes/README.md
index 22f02d9fe..02dc3c021 100644
--- a/docs/release-notes/README.md
+++ b/docs/release-notes/README.md
@@ -18,7 +18,18 @@ that list by the conventional-commit type in the **PR title**:
`TYPE_SECTIONS` in `scripts/release-notes.mjs` is the one copy of that table. A type nobody mapped —
or a PR title with no conventional prefix at all — lands in **Improved**, visible, with its title
-intact. Nothing is ever dropped except the previous tag's `chore(release):` version bump.
+intact. Nothing is ever dropped except the previous tag's `chore(release):` version bump and PRs
+labelled **`no-release-notes`**.
+
+### Leaving a PR out: the `no-release-notes` label
+
+A PR carrying the `no-release-notes` label is left out of the generated notes entirely — not folded
+into Internal changes, not counted. It exists for work that ships switched off and must not be
+announced until it is switched on; ordinary internal work stays in the collapsed section. The
+generator looks the labelled PRs up on every run (`EXCLUDE_LABEL` in `scripts/release-notes.mjs`),
+and a failed lookup fails the generator rather than publishing notes that ignored the label. That
+failure, like any other, falls back to the plain `git log` list (see Failure), which knows nothing
+about labels — check the notes by hand if the job log shows that warning.
## Layer 2 — Highlights (optional, written by hand)
@@ -72,4 +83,4 @@ node scripts/release-notes.mjs --tag v0.3.8 --prev v0.3.7 --repo eneskirca/nodet
It reads `docs/release-notes/<tag>.md` from the working directory (`--root` to point elsewhere) and
prints to stdout unless given `--out`. `--body-file` substitutes a saved `generate-notes` body for
-the API call.
+the API call, and `--exclude <pr,pr>` the label lookup.
diff --git a/scripts/release-notes.mjs b/scripts/release-notes.mjs
index 28ed96392..e33b0ac53 100644
--- a/scripts/release-notes.mjs
+++ b/scripts/release-notes.mjs
@@ -20,6 +20,12 @@
// config would put every entry in one bucket, so the type comes from the conventional-commit
// prefix in the PR title instead, through the single table below.
//
+// ONE WAY TO LEAVE A PR OUT: the `no-release-notes` label (EXCLUDE_LABEL). A PR carrying it is
+// dropped entirely — not folded into Internal changes, not counted, not linked. It is for work that
+// ships switched off and must not be announced before it is switched on; everything else, internal
+// work included, stays in the notes. The labelled PRs are looked up per run (`gh api`), and a failed
+// lookup fails the generator rather than publishing notes that silently ignored the label.
+//
// NON-ENGLISH / OUT-OF-CONTEXT SUBJECTS are deliberately NOT special-cased here. This layer
// publishes what it is given, verbatim, in its mapped section; it never translates, rewrites
// or drops a line, because a detector that guesses wrong either mangles a real entry or
@@ -76,6 +82,9 @@ export const TYPE_SECTIONS = {
*/
export const UNMAPPED_SECTION = 'improved'
+/** PRs carrying this label never reach the notes (see the header). */
+export const EXCLUDE_LABEL = 'no-release-notes'
+
/** The version-bump commit for the PREVIOUS tag lands in every range. It is pure noise. */
const RELEASE_BUMP_RE = /^chore\(release\)/i
@@ -180,6 +189,21 @@ export function parseGeneratedBody(body) {
return { entries, newContributors, unparsed }
}
+/** `entries` without the PRs numbered in `excluded` (an iterable of PR numbers). */
+export function dropExcluded(entries, excluded) {
+ const skip = new Set([...(excluded ?? [])].map(Number))
+ return entries.filter((entry) => !skip.has(entry.pr))
+}
+
+/** PR numbers from `gh --jq` output (one per line) or a hand-typed comma list. */
+export function parseExcludeList(text) {
+ return String(text ?? '')
+ .split(/[\s,]+/)
+ .filter(Boolean)
+ .map(Number)
+ .filter((n) => Number.isSafeInteger(n) && n > 0)
+}
+
/** Group parsed entries into the section order above. Release-bump entries are dropped. */
export function groupEntries(entries) {
const groups = Object.fromEntries(SECTIONS.map((s) => [s.key, []]))
@@ -213,9 +237,9 @@ function compareUrl(repo, prev, tag) {
* Render the whole body. Pure: every input is a value, so the tests exercise exactly what CI
* publishes.
*/
-export function renderNotes({ tag, prev, repo, body, highlights }) {
+export function renderNotes({ tag, prev, repo, body, highlights, exclude }) {
const { entries, newContributors, unparsed } = parseGeneratedBody(body)
- const { groups } = groupEntries(entries)
+ const { groups } = groupEntries(dropExcluded(entries, exclude))
for (const line of unparsed) groups[UNMAPPED_SECTION].push({ raw: line })
const compare = compareUrl(repo, prev, tag)
@@ -284,6 +308,22 @@ function generatedBody({ repo, tag, prev }) {
return execFileSync('gh', args, { encoding: 'utf8', maxBuffer: 32 * 1024 * 1024 })
}
+/** The numbers of every PR (open or closed) carrying EXCLUDE_LABEL. Throws when the lookup fails. */
+function excludedPrs({ repo }) {
+ const out = execFileSync(
+ 'gh',
+ [
+ 'api',
+ '--paginate',
+ `repos/${repo}/issues?labels=${EXCLUDE_LABEL}&state=all&per_page=100`,
+ '--jq',
+ '.[] | select(.pull_request) | .number'
+ ],
+ { encoding: 'utf8', maxBuffer: 8 * 1024 * 1024 }
+ )
+ return parseExcludeList(out)
+}
+
export function highlightsPathFor(tag) {
return `docs/release-notes/${tag}.md`
}
@@ -305,17 +345,22 @@ function main() {
const tag = args.tag
const repo = args.repo
if (!tag || !repo) {
- console.error('usage: release-notes.mjs --tag <tag> --repo <owner/name> [--prev <tag>] [--out <file>] [--body-file <file>]')
+ console.error(
+ 'usage: release-notes.mjs --tag <tag> --repo <owner/name> [--prev <tag>] [--out <file>] [--body-file <file>] [--exclude <pr,pr>]'
+ )
process.exit(2)
}
const prev = args.prev && args.prev !== 'true' ? args.prev : ''
const body = args['body-file'] ? readFileSync(args['body-file'], 'utf8') : generatedBody({ repo, tag, prev })
+ // `--exclude` stands in for the label lookup (tests, a hand run against a saved body).
+ const exclude = args.exclude !== undefined ? parseExcludeList(args.exclude === 'true' ? '' : args.exclude) : excludedPrs({ repo })
const notes = renderNotes({
tag,
prev,
repo,
body,
- highlights: readHighlights(tag, args.root)
+ highlights: readHighlights(tag, args.root),
+ exclude
})
if (args.out && args.out !== 'true') writeFileSync(args.out, notes)
else process.stdout.write(notes)
diff --git a/scripts/release-notes.test.ts b/scripts/release-notes.test.ts
index 0216acd9a..4700889bc 100644
--- a/scripts/release-notes.test.ts
+++ b/scripts/release-notes.test.ts
@@ -1,5 +1,12 @@
import { describe, it, expect } from 'vitest'
+import { spawnSync } from 'node:child_process'
+import fs from 'node:fs'
+import path from 'node:path'
+import { testTmpDir } from '../src/core/test-tmp'
import {
+ EXCLUDE_LABEL,
+ dropExcluded,
+ parseExcludeList,
SECTIONS,
TYPE_SECTIONS,
UNMAPPED_SECTION,
@@ -296,3 +303,55 @@ describe('truncation is never silent', () => {
expect(out).toContain('[#1000]')
})
})
+
+describe('PRs labelled no-release-notes', () => {
+ it('names the label once', () => {
+ expect(EXCLUDE_LABEL).toBe('no-release-notes')
+ })
+
+ it('are left out entirely — not folded into Internal, not counted, not linked', () => {
+ const out = render({ exclude: [796, 806] })
+ expect(out).not.toContain('[#796]')
+ expect(out).not.toContain('notch')
+ expect(out).not.toContain('[#806]')
+ expect(out).not.toContain('settings doc claims')
+ // The internal fold counts what is left (the dependabot bump), not what was dropped.
+ expect(out).toContain('<summary><strong>Internal changes</strong> (1)')
+ // Everything else is untouched.
+ expect(out).toContain('[#801]')
+ expect(out).toContain('[#803]')
+ expect(out).toContain('[#697]')
+ })
+
+ it('drop nothing when no PR is labelled', () => {
+ expect(render({ exclude: [] })).toBe(render())
+ expect(render({ exclude: [12345] })).toBe(render())
+ })
+
+ it('dropExcluded matches on the PR number only', () => {
+ const entries = parseGeneratedBody(GENERATED).entries
+ expect(dropExcluded(entries, new Set([801])).map((e: { pr: number }) => e.pr)).toEqual([796, 795, 803, 806, 697])
+ })
+
+ it('parseExcludeList reads gh --jq output or a comma list, ignoring blanks', () => {
+ expect(parseExcludeList('1334\n1335\n\n')).toEqual([1334, 1335])
+ expect(parseExcludeList('1334,1335, 1336')).toEqual([1334, 1335, 1336])
+ expect(parseExcludeList('')).toEqual([])
+ })
+
+ it('the CLI drops them given --exclude, without asking GitHub for the label', () => {
+ const dir = testTmpDir('nt-release-notes-')
+ const bodyFile = path.join(dir, 'body.md')
+ fs.writeFileSync(bodyFile, GENERATED)
+ const r = spawnSync(
+ process.execPath,
+ [path.resolve(__dirname, 'release-notes.mjs'), '--tag', 'v0.3.8', '--prev', 'v0.3.7', '--repo', REPO,
+ '--body-file', bodyFile, '--root', dir, '--exclude', '796,806'],
+ { encoding: 'utf8', env: { ...process.env, PATH: '' } }
+ )
+ expect(r.status, r.stderr).toBe(0)
+ expect(r.stdout).toContain('[#801]')
+ expect(r.stdout).not.toContain('[#796]')
+ expect(r.stdout).not.toContain('[#806]')
+ })
+})