No description
- Python 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| .fragcha | ||
| fragcha | ||
| .gitignore | ||
| agpl-3.0.md | ||
| CHANGELOG.md | ||
| fragcha.json5 | ||
| LICENSE.md | ||
| pyproject.toml | ||
| README.md | ||
| renovate.json5 | ||
| requirements.txt | ||
Fragcha - Automate changelog from fragments
Installation
pip install fragcha
Usage
usage: python -m fragcha [-h] [--fragments FRAGMENTS] [--config CONFIG] {bump,changelog,renovate} ...
positional arguments:
{bump,changelog,renovate}
bump Generate subsequent semver based on changelog fragments
changelog Generate changelog from fragments
renovate Generate changelog fragments for renovate pull requests
options:
-h, --help show this help message and exit
--fragments FRAGMENTS
Folder with changelog fragments (.yaml or .yml)
--config CONFIG Path to config file
usage: python -m fragcha bump [-h] --version VERSION [--output OUTPUT] [--ignore-major-zero]
options:
-h, --help show this help message and exit
--version VERSION Current version for which to generate the subsequent semver
--output OUTPUT File append changelog to (- for stdout)
--ignore-major-zero Don't treat major version 0 special (use to move from 0.X.Y to 1.0.0)
usage: python -m fragcha changelog [-h] [--version VERSION] [--output OUTPUT] [--append]
options:
-h, --help show this help message and exit
--version VERSION Version number to use in changelog header
--output OUTPUT File append changelog to (- for stdout)
--append Append to output file instead of prepending
usage: python -m fragcha renovate [-h] --data-file DATA_FILE [--section SECTION]
options:
-h, --help show this help message and exit
--data-file DATA_FILE
Renovate data file (will resolve environment variables if it starts with $)
--section SECTION Section for changelog entries (default: dependencies)
This expects the DATA_FILE to use this template:
"dataFileTemplate": "{\"branchName\":\"{{{branchName}}}\",\"upgrades\":[{{#each upgrades}}{\"depName\": \"{{{depName}}}\", \"currentVersion\": \"{{{currentVersion}}}\", \"newVersion\": \"{{{newVersion}}}\"}{{#unless @last}},{{\/unless}}{{\/each}}]}"
See renovate documentation for more details.
Example changelog fragment
Without any extra configuration fragcha will check the .fragcha directory for yml and yaml files to generate a
changelog from. This is an example with all sections that are available by default:
breaking_changes:
- This is a major change, it will cause `fragcha bump` to increase the major version (except when on major version 0)
features:
- This is a minor change, it will cause `fragcha bump` to increase the minor version
bugfixes:
- This is a patch change, it will cause `fragcha bump` to increase the patch version
documentation:
- This is a misc change, it will cause `fragcha bump` to increase the patch version
Example config
The build in defaults are equivalent to this fragcha.json5 being present:
{
"sections": {
"major": {
"breaking_changes": "Breaking Changes"
},
"minor": {
"features": "Features"
},
"patch": {
"bugfixes": "Fixed bugs",
"dependencies": "Dependency updates"
},
"misc": {
"documentation": "Documentation"
}
},
"renovate-template": "Updated {{ depName }} to {{ newVersion }}",
"template": "# {{ version }}\n\
\n\
{%- for section in sections %}\n\
## {{ section.title }}\n\
{%- for change in section['changes'] %}\n\
- {{ change }}\n\
{%- endfor %}\n\
{%- endfor %}\n\
***\n\
"
}