Changelog contract
SWARQ keeps two kinds of changelog. Each has one owner, so no file is written by two tools.
| File | Written by | Who edits it | Purpose |
|---|---|---|---|
CHANGELOG.md (repository root) |
People, in each pull request | The author of the change | Project-level release notes and release evidence, checked by hardened-changelogger |
packages/*/CHANGELOG.md |
changeset version |
Nobody by hand | Per-package history, from the .changeset/*.md files |
versioning.md §4 covers the per-package files. This page covers the root file.
The root file
CHANGELOG.md follows the contract in @h4shed/rock-hardened, pinned at the workspace root.
## [Unreleased]
### Added
#### Short entry title- What changed, in one line a user can read.
<!-- release-metaimpact: normalaudience: developermarketing: falsecategory: featurestatus: shipped-->- Put new entries under
## [Unreleased], in the category that fits:Added,Changed,Deprecated,Removed,Fixed, orSecurity. - Each entry starts with a
####title. Bullets under it are the body. - The
release-metablock is optional. Its keys areimpact(major,normal,minor,internal),audience,marketing,category, andstatus(shipped,preview,coming-soon,internal). Any other value fails validation. - A security fix names its advisory ID, as
versioning.md§4 requires. - Entry titles must be unique within
[Unreleased].
Commands
pnpm check:changelog # hc validate: structure, entries, release-meta valuespnpm exec hc manifest # release-artifacts/release-manifest.json (hashes the changelog)pnpm exec hc ci --require-changed --base origin/mainvalidate fails on an empty [Unreleased] section, so a new entry must come with the change it describes. ci --require-changed also fails when CHANGELOG.md did not change against the base branch. Use it in pull-request CI once the workflow is added (see below).
Relation to Changesets
A pull request that changes a versioned package still needs a changeset, as versioning.md §3 requires. The changeset feeds the package changelog. The root CHANGELOG.md entry describes the same change for the project. Write both. The root entry is the one reviewers read for the whole project.
New projects
swarq init-workspace creates a starter CHANGELOG.md and release-contract.config.json. The starter has one Workspace created entry, so validate passes on the first run. To use the contract in a new project:
npm install --save-dev @h4shed/rock-hardenednpx hardened-changelogger validateNot set up yet
- CI workflow.
hc initcopiesrelease-contract.ymlinto.github/workflows/. It is not added to this repository, because it would become a required check. Decide that with the maintainer first. - Release artifacts.
release-artifacts/is the output directory and is ignored by git. The output is generated per commit, so publish it as a CI artifact or release asset instead of committing it. - Signing.
attestsigns only whenHC_SIGNING_KEYpoints at a key outside the repository. No key exists for this project. - Playwright.
render --pngneeds Playwright, which rock-hardened lists as an optional dependency. It is installed with the package and not used by the scripts here.