Skip to content

ci: publish curated release notes - #123

Merged
uniqueg merged 4 commits into
devfrom
ci/curated-release-notes
Nov 18, 2026
Merged

uniqueg merged 4 commits into
devfrom
ci/curated-release-notes

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Summary

The release workflow created releases with GitHub's generated notes only, to be edited by hand into the agreed format after publishing. The org's release pattern creates the release with the curated notes followed by the generated ones. This ports cloud-registry's mechanism, so that the 0.3.0 release is published in the agreed format:

  • Curated notes in docs/releases/<version>.md (parts 1 and 2 of the format: intro and grouped sections), listed in the nav of mkdocs.yml.
  • scripts/release_notes.py is cloud-registry's (canonical, named in its header), with commands check, body, require and first. Only DOCS_HOST and REPOSITORIES differ: links to versions that move are checked for Pubgrade's Read the Docs and both repositories (Pubgrade and Pubgrade-Sidecar). Pubgrade-Sidecar gets the same script (ci: publish curated release notes Pubgrade-Sidecar#73).
  • prepare, new step "Check release notes": fails before anything is pushed if the notes contain TODO, aren't in the agreed format, or are missing once any release has curated notes.
  • publish, "Create release": with curated notes, the body is the curated notes, then ## Commits with the generated notes (without "What's Changed"), then the **Full Changelog** line. Without them, the generated notes alone, as before. A re-run of a published release replaces its notes only with curated ones.
  • Tests: cloud-registry's tests, plus links of both repositories; test_curated_notes checks every file in docs/releases/, which must also have no TODO, so that CI rejects unfinished notes before the tag (a failed release can't reuse its tag).
  • Docs: "Versioning and releases" in docs/development.md: the format, the pre-tag checks, the nav entry (after "Development", before the Sidecar section that docs/hooks.py appends), and that a re-run replaces published notes.

The first curated notes (docs/releases/0.3.0.md) come with the release-prep pull request.

Closes #125

Verification

  • pytest --cov: 900 passed, 1 skipped, coverage 100%. test_curated_notes is skipped here (no notes yet); with a valid notes file that contains TODO it fails, without it it passes (checked with a temporary docs/releases/9.9.9.md, removed).
  • ruff check ., ruff format --check ., mypy: passed. pre-commit run --all-files: passed, except gitleaks and the actionlint hook, which couldn't install in the sandbox; actionlint 1.7.12 with shellcheck 0.11.0 run directly on release.yml, ci.yml and scan.yml: passed. gitleaks runs in CI.
  • mkdocs build --strict (submodule external/pubgrade-sidecar checked out): passed.
  • Local dry run of the two changed steps, extracted from release.yml with yq and run with a stub gh (script in the agent's scratchpad): with curated notes and no release yet, the release is created as a draft and published with the curated notes, ## Commits and the Full Changelog line; for a published release, its notes are replaced with the curated ones; without curated notes, a published release's notes are left alone.
  • Not run: a fork dry run with a test tag (agents don't push tags). The changed shell is the same as cloud-registry's release workflow, which published 1.0.0rc2 with it.
  • Symlink guard (from Sourcery's review of Pubgrade#123, in both repos): the steps "Check release notes" and the guard of "Create release", extracted from release.yml, run against a regular file (passes), a file symlink, a directory symlink and a dangling symlink (all fail) and no notes (passes). Notes dry run and actionlint passed again.
  • CI: passed (run 44210601927, all jobs); Sourcery review passed, no open threads.

Declined review findings

  • Share or slim the script (quality, medium): it stays a copy of cloud-registry's, which is canonical. Sharing it through elixir-cloud-aai/.github would be a change for all repos that use it; its header now names the canonical copy and the two constants that differ, so a sync replaces everything else.
  • Move the TODO check into the script (quality and adversarial, medium/low): kept in the workflow, as in cloud-registry, so that the copies stay the same. CI now rejects TODO through test_curated_notes instead, and the pre-tag steps in the docs run the same grep.
  • Case-insensitive TODO / TBD check (adversarial, low): as above; cloud-registry's rule is TODO.
  • Shorter header comment in release.yml (quality, low): it follows cloud-registry's workflow comment.
  • Sanitize raw HTML in the notes (Sourcery, high): the notes are a docs page like any other, written by maintainers and merged by review; MkDocs renders raw HTML on every page, and GitHub sanitizes release bodies itself.
  • Concurrent hand edits during a publish re-run (Sourcery, medium): a re-run is a rare recovery step, and the docs say that it writes the tagged notes back over hand edits.
  • Deleting all notes disables require (Sourcery, medium): that takes a reviewed PR that also removes them from the docs; same rule as cloud-registry's canonical script.
  • Backtick fence openers with a backtick in the info string (Sourcery, medium): a change to the checker goes to cloud-registry's canonical script first, then to the copies.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Publish releases with validated curated notes and GitHub-generated commit details while enforcing the organization-wide release note format.

New Features:

  • Publish curated release notes alongside GitHub-generated commit notes and changelog entries.

Bug Fixes:

  • Prevent unfinished, malformed, missing, or unsafe release notes from being published.

Enhancements:

  • Extend release note tooling to validate the agreed format, enforce versioned links, compose release bodies, and support required-note checks.
  • Document the curated release note format and release workflow behavior.

CI:

  • Add automated validation of all curated release notes in the test suite.

Documentation:

  • Update release development guidance with curated notes, pre-tag checks, and re-run behavior.

Tests:

  • Add comprehensive coverage for note validation, body generation, missing-note requirements, and link checks.

uniqueg and others added 3 commits November 18, 2026 00:02
The release workflow created releases with GitHub's generated notes
only, to be edited by hand into the agreed format after publishing. As
in cloud-registry, it now publishes the curated notes of
docs/releases/<version>.md followed by the generated ones, and fails
before anything is pushed if they contain TODO, aren't in the agreed
format, or are missing once any release has curated notes.

scripts/release_notes.py is cloud-registry's (commands check, body,
require and first), with the docs host and repositories of Pubgrade and
Pubgrade-Sidecar for the check of links to versions that move. The
tests are cloud-registry's, plus links of both repositories; they also
check every file in docs/releases/.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review fixes. The release workflow rejects curated notes with a TODO
only after the tag is pushed, which then can't be reused, so the test of
the notes in docs/releases/ now rejects them too, and the pre-tag steps
in docs/development.md run the same grep (as cloud-registry's do).

The docs also give the nav entry of the first notes, say that a re-run
replaces the notes of a published release with the curated ones, and
the script names cloud-registry's copy as canonical and the constants
that differ from it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every job of the release workflow reads the curated notes of the tagged
commit, which can't change, so a fix in docs/releases/<version>.md never
reaches a published release. Say that the notes must be right before the
tag, that published notes are fixed by hand (and in docs/releases/ on
dev, for the docs), and that a re-run of publish writes the tagged notes
back over hand edits.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg uniqueg added this to the v0.3.0 milestone Nov 17, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Add release-note validation, link checks, missing-note enforcement, generated-body composition, and CLI commands for checking and publishing curated notes.

  • scripts/release_notes.py L38-517, L657-704, L764-801 (+3 small edits)

Configuration

Validate curated notes before release and publish them with generated notes, while allowing published-release reruns to update notes only when curated notes exist.

  • .github/workflows/release.yml L22-32, L133-159, L525-535 (+4 small edits)

Documentation

Document the curated-notes workflow, required format and links, pre-tag checks, navigation entry, and published-release rerun behavior.

  • docs/development.md L191-205, L231-266

Tests

Test release-note validation and link rules, generated-body formatting, required-note behavior, and the notes shipped in the repository.

  • tests/scripts/test_release_notes.py L22-602, L671-674, L776-783 (+2 small edits)

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@read-the-docs-community

read-the-docs-community Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 Pubgrade | 🛠️ Build #35971381 | 📁 Comparing dd8faad against latest (1eb466e)

  🔍 Preview build  

1 file changed
± development/index.html

@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (1eb466e) to head (dd8faad).

Additional details and impacted files
@@            Coverage Diff             @@
##               dev      #123    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           18        18            
  Lines         1545      1748   +203     
==========================================
+ Hits          1545      1748   +203     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review November 18, 2026 00:03

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 5 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="scripts/release_notes.py" line_range="781" />
<code_context>
+        return _require(args)
+    notes: Path = args.notes
+    try:
+        curated = notes.read_text(encoding="utf-8")
+        generated = (
+            args.generated.read_text(encoding="utf-8") if args.command == "body" else ""
</code_context>
<issue_to_address>
**Release notes expose workflow token**

When a release commit makes `docs/releases/<version>.md` a symlink to `/proc/self/environ`, `Path.read_text()` follows the symlink, and `check()` accepts the NUL-separated environment as a nonempty intro paragraph; `body()` then writes it into the published release notes, exposing the `contents: write` token.

Reject symlinked notes and verify that the file opened for publication is a regular file within the checked-out repository, without following symlinks.
</issue_to_address>

### Comment 2
<location path="scripts/release_notes.py" line_range="471" />
<code_context>
+        that move (`UNVERSIONED`) and no relative links (`_link_targets`). An
+        HTML comment on a line of its own counts as a blank line.
+    """
+    lines = markdown.removeprefix("\ufeff").splitlines()
+    findings = _Checker().run(lines)
+    findings += [
</code_context>
<issue_to_address>
**Release notes permit stored script injection**

When an untrusted contributor's curated notes containing active HTML are merged and published, `check()` validates Markdown structure but does not sanitize raw HTML; an intro containing `<svg onload=alert(1)>` passes, and `body()` preserves it. MkDocs renders the curated file as a docs page, so opening that page executes attacker-supplied script in the site origin.

Sanitize Markdown with a strict HTML allowlist before it is added to the docs or release body, or reject raw HTML and event-handler attributes during validation.

Also at `scripts/release_notes.py:513`.
</issue_to_address>

### Comment 3
<location path=".github/workflows/release.yml" line_range="566" />
<code_context>
+          # ones (generated ones are left as they are)
           if [[ "${state}" != "published" ]]; then
               gh release upload "${TAG}" dist/* --clobber
               edit+=(--notes-file "${notes_file}")
+          elif [[ -f "${curated}" ]]; then
+              edit+=(--notes-file "${notes_file}")
</code_context>
<issue_to_address>
**Concurrent note edits are lost**

When a maintainer edits a published release body while a `publish` rerun is generating its notes and before it runs `gh release edit`, the publish job writes the body generated from the tagged commit over the published release body, so a maintainer’s concurrent correction in GitHub disappears.

Avoid replacing published release bodies during reruns, or coordinate edits so they occur only after the rerun completes.
</issue_to_address>

### Comment 4
<location path="scripts/release_notes.py" line_range="679-681" />
<code_context>
+    others = [
+        path
+        for path in releases.glob("*.md")
+        if path.name != notes.name and NOTES_NAME.fullmatch(path.name)
+    ]
+    return notes if others else None
+
+
</code_context>
<issue_to_address>
**Deleting notes disables the requirement**

When all existing curated release-note files are removed or renamed, all version-named files in `docs/releases/` are removed or renamed, so `missing_notes` finds no other release notes and `require` allows the next release to omit curated notes. The repository then silently reverts to generated-only notes despite the policy having been established.

Persist whether curated notes have been adopted, or determine that from published release history, rather than inferring it only from files currently present.
</issue_to_address>

### Comment 5
<location path="scripts/release_notes.py" line_range="86" />
<code_context>
+UNDERLINE = re.compile(r" {0,3}(?:(?:-[ \t]*)+|=+[ \t]*|(?:[*_][ \t]*){3,})")
+# Opening and closing lines of fenced code blocks: a block closes with a line
+# of the same character, at least as long as the opening one, and nothing else
+FENCE = re.compile(r"[ \t]*(?P<marker>`{3,}|~{3,})(?P<rest>.*)")
+# Top-level list items (bullets or numbered)
+ITEM = re.compile(r"(?:[-*+]|[0-9]+[.)])(?:[ \t]|$)")
</code_context>
<issue_to_address>
**Invalid fences hide headings**

When curated notes use a backtick fence opener whose info string contains a backtick, `FENCE` accepts the invalid opener, and `_Checker._code` then ignores headings until a matching closing line. Curated notes can therefore pass `check` while containing a rendered `## Commits`; when the workflow appends generated notes, the release body has an extra section or its generated notes are rendered as code.

Reject backtick fence openers whose info string contains a backtick before treating subsequent lines as code.

Also at `scripts/release_notes.py:343`.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 5 findings to address first, and a validation or assembly mistake could publish incorrect release notes alongside a release. Reverting the workflow would not change notes already published, but the release notes can be corrected, so the impact is bounded and repairable.

Blocking findings: scripts/release_notes.py:781, scripts/release_notes.py:471, .github/workflows/release.yml:566, scripts/release_notes.py:681, scripts/release_notes.py:86


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread scripts/release_notes.py Resolved
Comment thread scripts/release_notes.py Resolved
Comment thread .github/workflows/release.yml Resolved
Comment thread scripts/release_notes.py Resolved
Comment thread scripts/release_notes.py Resolved
A release commit whose docs/releases/<version>.md is a symbolic link
(of the file, or of a directory on the way) could make the release
publish another file as its body, e.g., /proc/self/environ with the
token of the "Create release" step. The "Check release notes" step in
prepare and "Create release" in publish now accept only a regular file
of the repository (Sourcery review).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Nov 18, 2026

Copy link
Copy Markdown

Linked issues

Checked at commit dd8faad

#125 ci: publish curated release notes · 4 of 5 met

# Requirement Status Notes
1 Add curated release notes in docs/releases/.md and list them in the mkdocs.yml nav. 🟡 Partly met The workflow supports notes at this path and the documentation tells release-prep to add them to the nav, but this diff adds neither a notes file nor a Releases nav entry; the PR defers the 0.3.0 notes to a separate release-prep pull request.
2 Port scripts/release_notes.py with the check, body, require and first commands. ✅ Met The script defines all four commands, including validation, body composition, missing-notes checks and first-release notes.
3 Add a prepare step that rejects TODOs, malformed notes, and missing notes once a release has curated notes. ✅ Met The workflow checks for TODO, runs the format check, and uses require to enforce notes after the first curated release.
4 Build the release body from curated notes followed by generated notes, use generated notes alone when curated notes are absent, and replace published notes on rerun only when curated notes exist. ✅ Met The Create release step implements these cases, including leaving published notes unchanged when curated notes are absent.
5 Document the release-note format and workflow in Versioning and releases in docs/development.md. ✅ Met The documentation covers the format, pre-tag checks, nav instructions, generated notes, and published-release rerun behavior.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New gaps against the linked issues

Comment thread docs/development.md Resolved
@uniqueg
uniqueg merged commit 2f51a5a into dev Nov 18, 2026
80 of 82 checks passed
@uniqueg
uniqueg deleted the ci/curated-release-notes branch November 18, 2026 03:34
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.

ci: publish curated release notes

1 participant