Repository navigation
Add changelog fragments in .changelog/ - #20592
Draft
RobinMalfait wants to merge 5 commits into
Draft
RobinMalfait wants to merge 5 commits into
RobinMalfait wants to merge 5 commits into
Conversation
…CHANGELOG.md` The script has three commands: - `preview` (the default) prints the full `CHANGELOG.md`, with the entries of the fragments in `[Unreleased]`. - `check` validates the fragments and the `[Unreleased]` section. - `release <version> [date]` writes the `## [<version>] - <date>` section, a new `[Unreleased]` section and the compare links, and deletes the fragments. An entry without a `[#…](…)` link gets the link of the pull request that added the fragment. The entries keep the order in which the pull requests merged, after the entries that are already in `[Unreleased]`. The tests run with vitest, in a new `scripts` project.
The `Changelog` job only needs Node.js, because the script has no dependencies. It is not a required check.
After each merge into `main` that changes `.changelog/`, `CHANGELOG.md` or the script, the workflow force-pushes one commit with the preview of `CHANGELOG.md` to the `changelog` branch. The preview has the entries of the fragments in `[Unreleased]`. The checkout has the full history without the file contents, so that the script finds the pull request that added each fragment. A push with the `GITHUB_TOKEN` starts no other workflows.
The line is the intro of `[Unreleased]`: the preview leaves it out, and `changelog release` keeps it in the new `[Unreleased]` section.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds changelog fragments, so that pull requests do not conflict with each other in
CHANGELOG.md.Each pull request that needs a changelog entry adds a Markdown file to
.changelog/, for example.changelog/vite-full-reload.md:The entry needs no link to the pull request. The script finds the pull request that added the fragment in the git history, and adds its link. An entry that already has a
[#…](…)link keeps it.Changes
scripts/changelog.mjshas three commands (also aspnpm changelog):pnpm --silent changelogprintsCHANGELOG.md, with the entries of the fragments in[Unreleased].pnpm changelog checkvalidates the fragments and the[Unreleased]section.pnpm changelog release <version> [<date>]moves the entries into a new## [<version>] - <date>section, updates the compare links, and deletes the fragments.[Unreleased]come first. The entries of the fragments follow, in the order in which their pull requests merged. Thus the current entries inCHANGELOG.mdkeep working during the transition.Changelogjob inci.ymlrunscheck. It only needs Node.js, and it is not a required check.changelog.ymlworkflow pushes the preview to thechangelogbranch after each merge intomainthat changes the fragments,CHANGELOG.mdor the script. The branch has one commit with onlyCHANGELOG.md.[Unreleased]inCHANGELOG.mdlinks to this preview..changelog/README.mdandCONTRIBUTING.mdexplain the format.scripts/changelog.test.mjs, in a newscriptsvitest project.Test plan
pnpm vitest run --project scriptsnode ./scripts/changelog.mjs checkChangelog previewworkflow and check thechangelogbranch.