Skip to content

ci(go): put the CHANGELOG section on the Go release page - #1502

Draft
coderdan wants to merge 2 commits into
nextfrom
ci/go-release-notes-from-changelog
Draft

coderdan wants to merge 2 commits into
nextfrom
ci/go-release-notes-from-changelog

Conversation

@coderdan

@coderdan coderdan commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Summary

A Go module release page on GitHub shows only the install commands and the checksums of the embedded WebAssembly (WASI) guests. The changes in the release, and any upgrade steps, live in languages/golang/CHANGELOG.md, and the release workflow never reads it. For v0.1.0-rc.3 that meant the warning about re-installing the EQL SQL bundle (it drops indexes and database grants, which must be restored) never reached anyone reading the release.

This PR makes release-golang.yml put the version's CHANGELOG section at the top of the release page. A version with no CHANGELOG section is refused before anything is built, so a release can't ship without notes.

Changes

.github/workflows/release-golang.yml

  • New notes job: checks out the commit, runs scripts/go-release-notes.mjs "$VERSION", and passes the result on as a job output. It holds no write token and runs nothing but actions/checkout and that script.
  • build now needs: notes, so a missing section stops the run in seconds, before the build.
  • publish takes the notes through an environment variable, NOTES, never written into its script, and puts them above a new ### Install heading followed by the existing install text.
  • The header comment and the job list describe the new job.

scripts/go-release-notes.mjs (new; Node built-ins only)

  • Takes the ## [<version>] section, matching the version exactly (rc.3 does not match rc.30), and refuses a missing or empty section.
  • Rewrites relative links to the file at the version's tag. They are relative to languages/golang/ and would point nowhere on a release page.
  • Joins soft-wrapped lines. The CHANGELOG wraps at 80 columns, and GitHub renders every newline in a release body as a line break (checked with the /markdown API in gfm mode). Fenced code blocks, headings, tables and quotes are left as they are.

scripts/__tests__/go-release-notes.test.mjs (new): the section parsing, link rewriting and line joining. Every version section in the real CHANGELOG produces notes with no relative link left. The workflow wiring is checked: no write permissions on notes, build and publish wait on it, notes reach publish only through the environment, and no node runs in publish. It also runs the real notes step in a scratch directory, for a version that has a section and for one that doesn't.

AGENTS.md: the Go release paragraph says a version needs a CHANGELOG section before dispatch.

Verification

  • vitest run --config scripts/vitest.config.mjs: 84 of 86 files pass, 1418 tests. The two failing files, bench-index-expressions and check-auth-npm-changeset, could not load in my local setup, which borrowed node_modules from a main install missing @changesets/parse and @cipherstash/eql; they don't touch these files. In go-release-artifact, 9 cases skip locally because they need bash 4 and GNU coreutils; that was already so before this PR.
  • Biome is clean on the new files.
  • actionlint wasn't run: it isn't installed here, and CI's actionlint job doesn't cover this workflow.
  • The notes step's output for 0.1.0-rc.3 was rendered through GitHub's /markdown API: no stray line breaks, the five headings, and the link resolves to the file on the tag. The same text is going on the rc.3 release page by hand.
  • The workflow itself hasn't been run; the next Go release is its first live run.

Related

Refs #1442, #1443

Review notes

  • The trust boundary, for the reviewer. publish holds contents: write and takes the notes as the release body, so they must come from something that ran no third-party code. That is why they come from a new job, not from a step in build. Step outputs can't be overwritten by later steps, but build runs cargo build scripts and the Go tests on the same runner afterwards, and the workflow's threat model treats that job as untrusted. publish still runs only git and gh.
  • The new rule. A pre-release cut from a branch (a partner alpha, say) now needs a CHANGELOG section on that branch too. One line is enough.
  • Re-runs. "Re-run failed jobs" after a failed publish reuses the notes output. A re-run that finds the release already there still only replaces the attached files and leaves the notes as they are.

A Go module release page carried only install commands and guest
checksums: release-golang.yml wrote its notes from a template and never
read languages/golang/CHANGELOG.md. rc.3's upgrade steps, which say that
re-installing EQL v4 drops indexes and grants, reached nobody reading
the release.

A new `notes` job takes the version's `## [X.Y.Z]` section with
scripts/go-release-notes.mjs and hands it to `publish`, which puts it
above the install text. The script rewrites relative links to the file
at the version's tag, since they resolve nowhere on a release page, and
joins the CHANGELOG's soft-wrapped lines, since GitHub renders every
newline in a release body as a line break.

The notes come from their own job because `publish` holds
contents: write and takes them as the release body. `build` runs
third-party code after checkout; `notes` runs only checkout and a
dependency-free Node script, so nothing in it could have written the
text but the script. `publish` stays git and gh only, and receives the
notes through the environment rather than interpolated into its script.

`build` waits for `notes`, so a version with no CHANGELOG section, or an
empty one, stops the release before the build rather than shipping a
page with no notes, as rc.1 and rc.2 did.
@coderabbitai

coderabbitai Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

The test was formatted with Biome 2.5.3 from an older install; next pins
^2.5.15, whose formatter breaks the it.each call differently, and CI's
code:check failed on it.
@changeset-bot

changeset-bot Bot commented Nov 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 1d214ea

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant