Skip to content

chore(release): generate CHANGELOG.md with git-cliff under cargo release - #2808

Merged
thiras merged 2 commits into
mainfrom
chore/git-cliff-changelog
Oct 31, 2026
Merged

thiras merged 2 commits into
mainfrom
chore/git-cliff-changelog

Conversation

@thiras

@thiras thiras commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • CHANGELOG.md is now git-cliff output. scripts/release-changelog.sh, the cargo-release pre-release-hook in release.toml, renders the whole Conventional Commit history with the version being cut as the newest section; the release commit (git commit -am) carries it. The hook writes by absolute path under WORKSPACE_ROOT, so the one-run-per-package behaviour leaves one file, and a preview run (DRY_RUN=true) writes nothing.
  • The committed file is the rendering as of v0.3.0 (7 sections). The same cliff.toml still renders the GitHub release notes in release.yml; its body now separates sections with a blank line, and the hook ends the file in a single newline so end-of-file-fixer leaves the release commit alone.
  • No more hand-written entries: the PR title is the changelog line, and ! after the type (or a BREAKING CHANGE: footer) files it under ### Breaking. The PR template, CONTRIBUTING.md, RELEASING.md, CLAUDE.md and docs/sponsord/architecture.md say so.
  • The generated file is excluded from markdownlint in both .markdownlintignore (pre-commit) and the ci.yml job globs (markdownlint-cli2 does not read the ignore file), and from the ADR anchor guard (ANCHOR_SRCS, the adr path filter).
  • scripts/tests/test_release_changelog.py covers the dry-run no-op, the missing-env and missing-git-cliff failures, the absolute-path arguments and the single trailing newline.

Verification

  • cargo release patch --workspace --no-confirm -vv on a clean tree: the hook is called 15 times (once per released package), exit 0, tree still clean, no crates/*/CHANGELOG.md.
  • WORKSPACE_ROOT=$PWD NEW_VERSION=0.4.0 DRY_RUN=false scripts/release-changelog.sh adds a ## [0.4.0] section and touches only CHANGELOG.md; with DRY_RUN=true the file is byte-identical.
  • pre-commit run --all-files: 25 hooks passed. markdownlint-cli2 with the CI globs: 0 errors. make -C adr check-refs: passes. uvx --with pyyaml pytest scripts/tests .github/scripts/tests: 479 passed.
  • Not verifiable before a tag: the first cargo release --execute with the hook. Check that the chore(release): vX commit's file list includes CHANGELOG.md.

🤖 Generated with Claude Code

CHANGELOG.md is git-cliff output. scripts/release-changelog.sh, the
cargo-release pre-release-hook, renders the whole Conventional Commit
history with the version being cut as the newest section, by absolute
path under WORKSPACE_ROOT so the per-package runs write one file, and
the release commit carries it. A preview run (DRY_RUN=true) writes
nothing. The same cliff.toml still renders the GitHub release notes.

The PR title is the changelog line; `!` or a BREAKING CHANGE footer
files it under Breaking. The PR template, CONTRIBUTING.md, RELEASING.md,
CLAUDE.md and the sponsord architecture doc say so instead of asking for
a hand-written entry. The generated file is excluded from markdownlint
(pre-commit and the ci.yml job) and from the ADR anchor guard.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 31, 2026 01:50
@github-actions

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

@github-code-quality

github-code-quality Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: Rust, Solidity

Rust / code-coverage/cargo-llvm-cov

main 4ece849 chore/git-cliff-chan... 2035877 +/-
77% 77% 0%
View coverage of the 3 most impacted files.
File main 4ece849 chore/git-cliff-chan... 2035877 +/-
crates/node/src/dht/publish.rs 80% 78% -2%
crates/protocol/src/framing.rs 93% 92% -1%
crates/node/src...s/client/mod.rs 91% 91% 0%

Solidity / code-coverage/forge

main 4ece849 chore/git-cliff-chan... 2035877 +/-
92% 92% 0%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated October 31, 2026 02:12 UTC

Copilot AI 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.

🔵 Needs a closer look

The cargo release --execute integration remains unverified, requiring maintainer confirmation that the signed release commit includes the generated CHANGELOG.md before publishing.

No open issues 🎉

What changed in this PR

Automates deCDN’s changelog generation during cargo release, using the same git-cliff configuration as GitHub release notes instead of hand-written entries.

Changes:

  • Adds a workspace-root release hook with dry-run handling, dependency checks, newline normalization, and focused tests.
  • Updates contributor and release guidance to use Conventional Commit titles and breaking-change markers.
  • Excludes the generated changelog from Markdown linting and ADR anchor checks.
File Description
scripts/​tests/​test_release_changelog.py Tests dry runs, missing prerequisites, absolute paths, and trailing newlines.
scripts/​release-changelog.sh Generates the root changelog during release execution.
RELEASING.md Documents automated generation and hook behavior.
release.toml Registers the pre-release hook.
docs/​sponsord/​architecture.md Documents PR-title markers for breaking changes.
CONTRIBUTING.md Replaces manual-entry guidance with generated-changelog guidance.
cliff.toml Updates the generated header and spacing between release sections.
CLAUDE.md Aligns sponsord guidance with breaking-change markers.
adr/​Makefile Removes the changelog from anchor-check inputs.
.markdownlintignore Excludes the generated changelog from Markdown linting.
.github/​workflows/​release.yml Updates comments describing changelog and release-note generation.
.github/​workflows/​ci.yml Excludes the changelog from linting and ADR job triggers.
.github/​pull_request_template.md Updates breaking-change instructions and removes the manual changelog checklist item.

Review effort: Balanced

…G pointers

The hook renders to a temporary file beside CHANGELOG.md and moves it
over, so a render error leaves the committed file alone (git-cliff opens
--output before it renders). It requires cliff.toml (git-cliff falls back
to its built-in template with exit 0), accepts only the literal true or
false for DRY_RUN, and refuses the renders git-cliff exits 0 on but a
release must not ship: an empty file, no section for the new version, no
section for the previous one. A preview renders and checks but does not
write, so those failures surface before the version bump.

Three source comments pointed at hand-written CHANGELOG prose; each now
carries what it needs. The CI tooling job installs the release
workflow's git-cliff so the real-render test runs there.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@thiras
thiras merged commit 4037280 into main Oct 31, 2026
38 checks passed
@thiras
thiras deleted the chore/git-cliff-changelog branch October 31, 2026 02:17
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.

2 participants