Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork10
PHP CLI to add latest release notes to a CHANGELOG
License
stefanzweifel/php-changelog-updater
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A PHP CLI to update a changelog with the latest release notes.
Want to automate the process of updating your changelog with GitHub Actions? Checkout thestefanzweifel/changelog-updater-action which does exactly that.
If your changelog follows the"Keep a Changelog" format and has a "Unreleased" heading in it, the CLI will update the link in and place the release notes below heading.
You can install the changelog-updater CLI as a composer dependency in your project or globally. It requires PHP 8.2 or higher.
composer global require wnx/changelog-updater
You can usechangelog-updater by running theupdate command with the following options.
php changelog-updater update \--release-notes="### Added-NewFeature A-NewFeature B### Changed- Update Feature C### Removes- Remove Feature D" \--latest-version="v1.0.0" \--release-date="2021-08-07" \--path-to-changelog="CHANGELOG.md" \--compare-url-target-revision="1.x" \--write
--release-date,--path-to-changelog,--compare-url-target-revision and--write are optional. Learn more about the options by runningphp changelog-updater update --help.
If a given version already exists in the CHANGELOG, the CLI will display a warning and not update the CHANGELOG.
Required. The release notes you want to add to your changelog. Should be markdown.
Required. Version number of the latest release. The value will be used as the heading text if--heading-text is not set. If the changelog has a "Unreleased" heading, the value will be used in the updated compare URL.
Example:v1.0.0
Optional (Defaults to current date). The date the latest version has been released. The value will be used in the release heading.
Optional (Defaults toCHANGELOG.md). Path to CHANGELOG.md file.
Optional (Defaults toHEAD). If the changelog has a "Unreleased" heading, the value will be used together with the--latest-version value in the updated compare URL.
Optional. Write the changes toCHANGELOG.md or to the value of--path-to-changelog.
Optional. Will output values forUNRELEASED_COMPARE_URL andRELEASE_COMPARE_URL that can be picked up by GitHub Actions and further used in ones Workflow.
Optional (Defaults to value of--latest-version). The text value used in the heading that is created for the new release.
##heading-text - 2021-02-01##[heading-text](https://github.com/org/repo/compare/v0.1.0...v1.0.0) - 2021-02-01
Optional. Tell the CLI explicitly to use the content between an "Unreleased Heading" and the previous version heading as release notes. The value from--release-notes will be ignored.
Optional. Don't add the release date to the release heading.
Optional. Look for GitHub usernames in--release-notes and linkify them. Currently not supported for release notes that are located in the existing changelog.
- Added a new feature @stefanzweifel+ Added a new feature [@stefanzweifel](https://github.com/stefanzweifel)
The CLI does its best to place the given release notes in the right place.The CLI looks for the first second level heading in your currentCHANGELOG.md file. It assumes that this heading represents the previous version. Here is an example of aCHANGELOG.md that the CLI can understand.
# Changelog## v1.0.0 - 2021-11-01### Added- Initial ReleaseThe CLI will then place the new version and its release notesabove the existing versions.
# Changelog+ ## v1.1.0 - 2021-11-10++ ### Added++ * New Feature+## v1.0.0 - 2021-11-01### Added* Initial Release
If the changelog does not contain a second level heading, it considers the changelog to be "empty". It will then place the release notes at the bottom of the document.
# ChangelogAll notable changes to this project will be documented in this file.+## v1.0.0 - 2021-11-01++### Added++* Initial Release
If your changelog follows the"Keep a Changelog" format and contains an "Unreleased"-heading with a link to the repository compare view, the CLI will automatically update the link in the Unreleased heading.
Here is an example of a changelog, before it is updated with the CLI.
# Changelog## [Unreleased](https://github.com/org/repo/compare/v1.0.0...HEAD)Please do not update the unreleased notes.<!-- Content should be placed here -->## v1.0.0 - 2021-01-01### Added- Initial ReleaseBelow you find a diff-view of how the CLI will update the changelog.
# Changelog+## [Unreleased](https://github.com/org/repo/compare/v1.1.0...HEAD)-## [Unreleased](https://github.com/org/repo/compare/v1.0.0...HEAD)Please do not update the unreleased notes.<!-- Content should be placed here -->+## [v1.1.0](https://github.com/org/repo/compare/v1.0.0...v1.1.0) - 2021-02-01++### Added++* New Feature A+* New Feature B+## v1.0.0 - 2021-01-01### Added* Initial Release
The content between the "Unreleased"-heading and the latest version will remain untouched by the CLI.
If you don't have a "Unreleased"-heading in your changelog, but the headings of your previous releases contain a link to the repository compare view, the CLI will add links to the compare view to the added release heading.
# Changelog+## [v1.1.0](https://github.com/org/repo/compare/v1.0.0...v1.1.0) - 2021-02-01++### Added++* New Feature A+* New Feature B+## [v1.0.0](https://github.com/org/repo/compare/v0.1.0...v1.0.0) - 2021-01-01### Added* Initial Release
composertestPlease seeCHANGELOG for more information on what has changed recently.
Please seeCONTRIBUTING for details.
Please reviewour security policy on how to report security vulnerabilities.
The MIT License (MIT). Please seeLicense File for more information.
About
PHP CLI to add latest release notes to a CHANGELOG
Topics
Resources
License
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.