-
Notifications
You must be signed in to change notification settings - Fork 3
docs: add change log style guide #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
tromai
wants to merge
2
commits into
canonical:main
Choose a base branch
from
tromai:add-change-log-style-guide
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| # Charm Tech change log style guide | ||
|
|
||
| This is the change log style we inherit from [canonical/operator](https://github.com/canonical/operator). | ||
|
|
||
| We will use this style going forward in all repos that we own. | ||
|
|
||
| ## File format | ||
|
|
||
| The change log is written in Markdown. The file is located in the root directory of a repo, with the name `CHANGES.md`. See [operator's change log](https://github.com/canonical/operator/blob/main/CHANGES.md) and [jubilant's change log](https://github.com/canonical/jubilant/blob/main/CHANGES.md). | ||
|
|
||
| ## Specification | ||
|
|
||
| Each `CHANGES.md` contains one or many sections. | ||
|
|
||
| Each section in the change log represents a release version, and the included commits. | ||
|
|
||
| The section title has the version number and its released date (in Github Release), separated by a dash `-`. | ||
|
|
||
| ``` | ||
| # {{ version_number }} - {{ date }} | ||
| ``` | ||
|
|
||
| For example, Jubilant [v1.9.0](https://github.com/canonical/jubilant/releases/tag/v1.9.0) has the following section title: | ||
|
|
||
| ``` | ||
| # 1.9.0 - 29 April 2026 | ||
| ``` | ||
|
|
||
| We use [conventional commits](https://www.conventionalcommits.org). Only these types of commit are recorded in `CHANGES.md`: `feat`, `fix`, `docs`, `test`, `refactor`, `ci`. Commit types not in these types are ignored. | ||
|
|
||
| Each commit type has its own Sub-section. The table below maps each commit type to a Sub-section. **All** breaking change commits belongs to their own Sub-section `Breaking changes`: | ||
|
|
||
| | Commit type | Sub-section | | ||
| | :--- | :--- | | ||
| | `<type>!:` | `## Breaking changes` | | ||
| | `feat:` | `## Features` | | ||
| | `fix:` | `## Fixes` | | ||
| | `docs:` | `## Documentation` | | ||
| | `test:` | `## Tests` | | ||
| | `refactor:` | `## Refactoring` | | ||
| | `ci:` | `## CI` | | ||
|
|
||
| The order of Sub-sections follow the table from top to bottom. For example: | ||
|
|
||
| ``` | ||
| # 1.9.0 - 29 April 2026 | ||
|
|
||
| ## Breaking Changes | ||
|
|
||
| * Commit message (#1) | ||
| * Commit message (#2) | ||
|
|
||
| ## Features | ||
|
|
||
| * Commit message (#1) | ||
| * Commit message (#2) | ||
|
|
||
| ## Fixes | ||
|
|
||
| * Commit message (#1) | ||
| * Commit message (#2) | ||
|
|
||
| ## Documentation | ||
|
|
||
| * Commit message (#1) | ||
| * Commit message (#2) | ||
|
|
||
| ## Tests | ||
|
|
||
| * Commit message (#1) | ||
| * Commit message (#2) | ||
|
|
||
| ## Refactoring | ||
|
|
||
| * Commit message (#1) | ||
| * Commit message (#2) | ||
|
|
||
| ## CI | ||
|
|
||
| * Commit message (#1) | ||
| * Commit message (#2) | ||
| ``` | ||
|
|
||
| If a Sub-section doesn't have a commit, it is not included. | ||
|
|
||
| Spacing: There is exactly one empty lines before and after each Section and Sub-section. There is no empty line between commits. | ||
|
|
||
| Each commit follows this format: | ||
|
|
||
| ``` | ||
| * {{ capitalized_first_letter_message }} #{{ Pull request number }} | ||
| ``` | ||
|
|
||
| If a commit doesn't follow conventional commit, discuss with the commit author or the team to decide. You must put all code symbols (for example: method names) in backticks. | ||
|
|
||
| ## Toolings | ||
|
|
||
| You can use [cliff](https://git-cliff.org/) to generate the change log. See [cliff.toml](./cliff.toml) for an example configuration. | ||
|
|
||
| Remember to double check the tool's result before checking it into the repo. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # git-cliff ~ configuration file | ||
| # https://git-cliff.org/docs/configuration | ||
|
|
||
| [changelog] | ||
| header = "# Changelog\n\n" | ||
|
|
||
| body = """ | ||
| {% if version %}\ | ||
| # {{ version | trim_start_matches(pat="v") }} - {{ timestamp | date(format="%d %B %Y") }} | ||
| {% for group, commits in commits | group_by(attribute="group") %} | ||
| ## {{ group | striptags | trim | upper_first }} | ||
| {% for commit in commits %} | ||
| * {{ commit.message | upper_first }}{% if commit.metadata.issue %} (#{{ commit.metadata.issue }}){% endif %}\ | ||
| {% endfor %} | ||
| {% endfor %} | ||
| {% endif %} | ||
| """ | ||
|
|
||
| trim = true | ||
|
|
||
| render_always = false | ||
|
|
||
| [git] | ||
| conventional_commits = true | ||
|
|
||
| filter_unconventional = false | ||
|
|
||
| commit_parsers = [ | ||
| # https://git-cliff.org/docs/tips-and-tricks#changing-the-group-order | ||
| { message = "^[a-z]*!:", group = "<!-- 0 -->Breaking Changes" }, | ||
| { message = "^feat", group = "<!-- 1 -->Features" }, | ||
| { message = "^fix", group = "<!-- 2 -->Fixes" }, | ||
| { message = "^docs", group = "<!-- 3 -->Documentation" }, | ||
| { message = "^test", group = "<!-- 4 -->Tests" }, | ||
| { message = "^refactor", group = "<!-- 5 -->Refactoring" }, | ||
| { message = "^ci", group = "<!-- 6 -->CI" }, | ||
| { message = "^chore", skip = true }, | ||
| ] | ||
|
|
||
| filter_commits = false | ||
|
|
||
| fail_on_unmatched_commit = false |
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too sure about putting this in the
styledirectory. May be we can have another directory for such files?