Skip to content

pg8wood/changelog-generator

Repository files navigation

changelog-generator

Curbing Cumbersome Changelog Conflicts

A tool that creates changelog entries and stores them as unique files to avoid merge conflicts in version control. When it's time to release, changelog publish collects these files and appends them to your changelog file using a format based on Keep a Changelog 1.0.0.

Why?

Teams that keep an up-to-date changelog are often plagued by merge conflicts introduced by the CHANGELOG file. This tool was inspired by GitLab's How we solved GitLab's CHANGELOG conflict crisis article and the README over at KiloKilo/changelog.

Installation

mint install pg8wood/changelog-generator

Manual Installation

swift build -c release
cp -f .build/release/changelog /usr/local/bin/changelog

Setup

  1. Create a directory in your project in which to store your unreleased changelog entries. By default, the tool looks in ./changelogs/unreleased. This may be changed with the --directory <path> option.
  2. Create your changelog file if it doesn't exist. By default, the tool looks for CHANGELOG.md. Use the --changelog-filename <path> option to customize.
  3. Add <!--Latest Release--> to the top of your changelog file. This anchor helps the tool parse previous releases when using the publish subcommand. It is not rendered by Markdown viewers. See this project's changelog for an example.
  4. If you'd like your changelog to contain a header before latest release, create changelogs/header.md (or use a custom markdown file and specify the --header <path> option) and add your header text as Markdown. This project's changelog header is prepended to the changelog with each release.

Usage

Help

To view all the available options, run $ changelog help

Log a New Change

Changelog entries may be added interactively with your favorite text editor, or quick entries can be passed as command-line arguments.

changelog add "Add something cool" "And something boring"

### Added
- Add something cool
- And something boring

🙌 Created changelog entry at changelogs/unreleased/<uniqueFilename>.md

Arguments

  <entry-type> The type of changelog entry to create.  
               Valid entry types are add, change, deprecate, remove, fix, and security.

  <text> A list of quoted strings separated by spaces to be recorded as a bulleted changelog entry. 
         If <text> is supplied, the --editor option is ignored and the changelog entry is created for you without opening an interactive text editor.

Options

  -d, --directory <path>  A directory where unpublished changelog entries will be written to / read from as Markdown files. (default: changelogs/unreleased/)
  -e, --editor <editor>   A terminal-based text editor executable in your $PATH used to write your changelog entry with more precision than the default bulleted list of changes. (default: vim)
  --version               Show the version.
  -h, --help              Show help information.

Publish a Release

$ changelog publish 1.0.0

## [1.0.0] - <release-date>

### Added
- Add something cool
- And something boring

### Changed
- Start following [Semantic Versioning](https://semver.org) properly 

### Fixed
- Fix all of <guy who used to work here>'s bugs

Nice! CHANGELOG.md was updated. Congrats on the release! 🥳🍻

Arguments

  <version> The version number associated with the changelog entries to be published. 
  <release-date> A string representing the date the version was published. Format MM-dd-yyyy. (default: <today>)

Options

  -d, --directory <path>  A directory where unpublished changelog entries will be written to / read from as Markdown files. (default: changelogs/unreleased/)
  --dry-run               Prints the changelog entries that would have been appended to the CHANGELOG and doesn't delete any files in changelogs/unreleased. 
  --changelog-filename <changelog-filename>
                          The CHANGELOG file to which the unreleased changelog entries will be prepended. (default: CHANGELOG.md)
  -h, --header <path>     A Markdown file containing optional header text that will be prepended to your changelog. (default: changelogs/header.md)
        If the supplied file does not exist or is not readable, no text will be prepended to the changelog.
  --help              Show help information.

Example Changelog

This project's changelog was generated by the changelog tool!