PHP CLI to add latest release notes to a CHANGELOG

Overview

changelog-updater

A PHP CLI to update a CHANGELOG following the "Keep a Changelog" format with the latest release notes.

Latest Version on Packagist Tests Check & fix styling Psalm Total Downloads

Want to automate the process of updating your Changelog with GitHub Actions? Checkout the stefanzweifel/changelog-updater-action which does exactly that.

Installation

You can install the changelog-updater CLI as a global composer dependency. It requires PHP 8.0 or higher.

composer global require wnx/changelog-updater

Usage

You can use changelog-updater by running the update command with the following options.

php changelog-updater update \
--release-notes="### Added
- New Feature A
- New Feature B

### Changed
- Update Feature C

### Removes
- Remove Feature D" \
--latest-version="v1.0.0" \
--release-date="2021-08-07" \
--path-to-changelog="CHANGELOG.md" \
--write

--release-date, --path-to-changelog and --write are optional. Learn more about the options by running php changelog-updater update --help.

Important

Note that the Changelog MUST follow the "Keep a Changelog"-format. The CLI looks for a second level "Unreleased"-heading with a link. The link MUST point to the compare view of the latest version and HEAD. The CLI also looks for a second level heading with the name of the previous version. (If you release v1.1.0 now, the previous version might be v1.0.0.)

Here is an example Markdown file, that will work fine with the CLI.

# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/org/repo/compare/v0.1.0...HEAD)

*Please do not manually update this file. We've automated the process.*

## v0.1.0 - 2021-01-01

### Added
- Initial Release

The content between the "Unreleased"-heading and the latest version will remain untouched by the CLI.

CLI Options

--release-notes

Required. The release notes you want to add to your CHANGELOG. Should be markdown.

--latest-version

Required. Version number of the latest release. The value will be used as the heading text and as a parameter in the compare URL.

Example: v1.0.0

--release-date

Optional (Defaults to current date). The date the latest version has been released. The value will be used in the release heading.

--path-to-changelog

Optional (Defaults to CHANGELOG.md). Path to CHANGELOG.md file.

--write

Optional. Write the changes to CHANGELOG.md or to the value of --path-to-changelog.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Comments
  • Creates invalid changelog files if release notes are not 3x#

    Creates invalid changelog files if release notes are not 3x#

    When using this plugin together with github's auto changelog generator, it ends up creating invalid changelog, as GitHub by default uses a h2, not a h3 for their headers.

    Taking a look at Laravel Health from Spatie, we can see here how the changelog file is invalid, making tools unable to read it correctly. https://github.com/spatie/laravel-health/blob/main/CHANGELOG.md

    It would be cool if the plugin could change the headers to the right one, so it can be used together with githubs auto changelog feature 👍

    enhancement 
    opened by olivernybroe 6
  • Make `--release-date` option optional and fall back to current date

    Make `--release-date` option optional and fall back to current date

    The main idea behind this CLI, is to use it in the context of GitHub Actions. There are ways to generate the current date in the right format in Actions, but its 10x easier to do in PHP.

    enhancement 
    opened by stefanzweifel 1
  • Update CLI to use new GITHUB_OUTPUT environment

    Update CLI to use new GITHUB_OUTPUT environment

    Updates the CLI to support new GITHUB_OUTPUT environment to declare output variables.

    Fixes https://github.com/stefanzweifel/changelog-updater-action/issues/25

    changelog:changed 
    opened by stefanzweifel 0
  • Add `--heading-text` option to manipulate heading text

    Add `--heading-text` option to manipulate heading text

    This PR adds a new --heading-text option to change the text of the release heading (currently defaults to the value of --latest-version).

    This change allows users to pass an arbitrary value as the heading, if they don't want to use the tag name as the heading name.

    Related issues

    • https://github.com/stefanzweifel/changelog-updater-action/issues/19
    changelog:added 
    opened by stefanzweifel 0
  • Shift Headings to Release Notes to always be at least level 3 headings

    Shift Headings to Release Notes to always be at least level 3 headings

    This PR adds a new internal Action to Shift headings contained in the incoming release notes to be at least level 3 headings.

    For example, the following release notes markdown …

    ## Added
    - New Feature A
    
    ## Changed
    - Update Feature C
    
    ## Removes
    - Remove Feature D
    

    is converted to this:

    ### Added
    - New Feature A
    - New Feature B
    
    ### Changed
    - Update Feature C
    
    ### Removes
    - Remove Feature D
    

    The PR currently only shifts headings below level 3 (H1 and H2). This breaks the hierarchy, if for example H3 headings are also present in the release notes. Still figuring out, if it would make sense to shift all headings automatically.

    refs #22

    changelog:added 
    opened by stefanzweifel 0
  • Fix: Abort and Show Error Message when Release Notes could not be placed

    Fix: Abort and Show Error Message when Release Notes could not be placed

    Fixes an issue where the CLI silently failed when the release notes could not be placed due to a missing child in the parsed Markdown AST – eg. the CHANGELOG file is empty.

    changelog:fixed 
    opened by stefanzweifel 0
  • Add RELEASE_HEADING_FRAGMENT output

    Add RELEASE_HEADING_FRAGMENT output

    This PR adds a new ExtractPermalinkFragmentFromHeading-action. It generates/extracts the URL fragment of the given heading, so that the consumer of the CLI/Action can generate an URL to point directly to the created release.

    The Action:

    • attaches a heading permalink to the given given heading
    • renders the heading to HTML
    • extracts the href-value
    • outputs the value for GitHub Actions as RELEASE_URL_FRAGMENT

    fixes https://github.com/stefanzweifel/changelog-updater-action/issues/13.

    changelog:added 
    opened by stefanzweifel 0
  • Fix detection of empty release notes

    Fix detection of empty release notes

    Instead of using is_null() to detect empty release notes, we now use empty(). The Action itself always passed the option but only changes the value from a string to an empty string "".

    See https://github.com/stefanzweifel/changelog-updater-action/issues/12#issuecomment-1073115279.

    changelog:fixed 
    opened by stefanzweifel 0
  • Output GitHub Actions Output Variables

    Output GitHub Actions Output Variables

    This PR addresses the issue raised in https://github.com/stefanzweifel/changelog-updater-action/issues/14. If enabled through the --github-actions-output=true option, the CLI will create GitHub Actions output variables.

    The values are:

    • RELEASE_COMPARE_URL: The compare URL between the previous and latest release (eg. https://github.com/org/repo/compare/v0.1.0...v1.0.0)
    • UNRELEASED_COMPARE_URL: The compare URL between the latest release and the target revision (eg. https://github.com/org/repo/compare/v1.0.0...HEAD)

    Have not tested yet, if this actually works in GitHub Actions.


    I think the use of Illuminate\Support\MessageBag in the GitHubActionsOutput-singleton is pretty smart, as we can reuse the powerful MessageBag-component from Laravel. 🏄

    Related Issues

    • https://github.com/stefanzweifel/changelog-updater-action/issues/14
    changelog:added 
    opened by stefanzweifel 0
  • Make Release Notes Optional

    Make Release Notes Optional

    This PR addresses the issue raised in https://github.com/stefanzweifel/changelog-updater-action/issues/12. It makes the --release-notes option optional. If no release notes have been given, a new release heading is placed directly after the Unreleased heading.

    Releated Issues

    • https://github.com/stefanzweifel/changelog-updater-action/issues/12

    TODOs

    • [x] Update PasteReleaseNotesAtTheTop
    changelog:changed 
    opened by stefanzweifel 0
  • Throw Warning if Release already exists in Changelog

    Throw Warning if Release already exists in Changelog

    This PR updates the CLI to no longer add release notes to a changelog, if the given version already exists in the changelog. Instead a warning is displayed.

    "CHANGELOG was not updated as release notes for {$release} already exist."

    changelog:added 
    opened by stefanzweifel 0
Releases(v1.6.2)
Owner
Stefan Zweifel
Full Stack Developer working with Laravel, Vue.js, Tailwind CSS and alpine.js.
Stefan Zweifel
🖥 Build beautiful PHP CLI menus. Simple yet Powerful. Expressive DSL.

Contents Minimum Requirements Installation Upgrading Usage Quick Setup Examples API Appearance Menu Title Colour Width Padding Margin Borders Exit But

PHP School 1.9k Dec 28, 2022
An Elegant CLI Library for PHP

Commando An Elegant PHP CLI Library Commando is a PHP command line interface library that beautifies and simplifies writing PHP scripts intended for c

Nate Good 793 Dec 25, 2022
Cilex a lightweight framework for creating PHP CLI scripts inspired by Silex

Cilex, a simple Command Line Interface framework Cilex is a simple command line application framework to develop simple tools based on Symfony2 compon

null 624 Dec 6, 2022
PHP Version Manager for the CLI on Windows

This package has a much more niche use case than nvm does. When developing on Windows and using the integrated terminal, it's quite difficult to get those terminals to actually listen to PATH changes.

Harry Bayliss 49 Dec 19, 2022
PHP CLI tool which allows publishing zipped MODX extra to modstore.pro marketplace

MODX Extra Publisher PHP CLI tool which allows publishing zipped MODX extra to modstore.pro marketplace. Installation global? local? To install packag

Ivan Klimchuk 3 Aug 6, 2021
PHP CLI project to get an appointment from https://vacunacovid.catsalut.gencat.ca

covid_vaccine_bcn PHP CLI project to get an appointment from https://citavacunacovid19.catsalut.gencat.cat/Vacunacio_Covid/Vacunacio/VacunacioCovidRes

Gabriel Noé González 3 Jul 27, 2021
unofficial cli built using php which can be used to upload and download files from anonfiles.com

Anonfiles CLI Table of Contents Introduction Features Screenshots Installation Contributing License Introduction Anon Files CLI can upload and downloa

Albin Varghese 8 Nov 21, 2022
Library for creating CLI commands or applications

Console Motivation: this library purpose is to provide a lighter and more robust API for console commands and/or applications to symfony/console. It c

Théo FIDRY 16 Dec 28, 2022
A handy set of Stringable mixins for CLI text.

Laravel Colorize A mixin for Laravel's Stringable to easily apply colors and styles to CLI text. Installation You can install the package via Composer

James Brooks 47 Oct 30, 2022
WP-CLI Trait Package Command

WP-CLI Trait Package Command Generate plugin or php model files e.g. post-type or taxonomy for WP-Trait Package in Develop WordPress Plugin. Installat

Mehrshad Darzi 2 Dec 17, 2021
A CLI program that helps you check your endpoints by requesting the given servers and send a report message in any supported channel like Telegram

API Monitor A CLI program that help you check your endpoints by requesting the given servers and send a report message in any supported channel ( Tele

Hussein Feras 51 Aug 21, 2022
Termage provides a fluent and incredibly powerful object-oriented interface for customizing CLI output text color, background, formatting, theming and more.

Termage provides a fluent and incredibly powerful object-oriented interface for customizing CLI output text color, background, formatting, theming and

TERMAGE 75 Dec 20, 2022
A CLI starter pack for developing a package with Laravel 5

Laravel PackMe Laravel PackMe is a project starter pack which combine all basic stuff (src, tests) in order to develop a package for Laravel 5.*. It t

Pierre Tondereau 63 Dec 29, 2021
PHPFusion CLI

PHPFusion CLI Installation Source Add path\to\PF-CLI\bin to your system PATH .phar file Download pf.phar Check the Phar file to verify that it's worki

PF Projects 0 Mar 20, 2022
Drupal.org Git CLI

doGit Drupal.org + Git CLI application. doGit assists in making the transition to merge requests, and general Git operations, easier for Drupal develo

dpi 16 Dec 15, 2022
A Magento 2 module that adds a CLI bin/magento cms:dump to dump all CMS pages and CMS blocks to a folder var/cms-output.

A Magento 2 module that adds a CLI bin/magento cms:dump to dump all CMS pages and CMS blocks to a folder var/cms-output.

Yireo 16 Dec 16, 2022
Host Onion services in dark web using Heroku CLI

Tor Onion Service On Heroku Host Tor v3 Hidden Service in dark web using heroku Try my another repository built with php https://github.com/sumithemma

Emmadi Sumith Kumar 34 Dec 13, 2022
Plugin Machine CLI

PHP CLI For Plugin Machine Install composer global require imaginary-machines/plugin-machine-php-cli:dev-main -W Requires Composer 2.0 or later PHP 7.

Imaginary Machines (Plugin Machine| {Future} Machine(s) 2 Jan 6, 2022