Skip to content

Commit

Permalink
chore: Use git-cliff changelog generator (blockscout#9687)
Browse files Browse the repository at this point in the history
* chore: Use git-cliff changelog generator

* Update cliff.toml

Co-authored-by: Maxim Filonov <[email protected]>

* Update cliff.toml

Co-authored-by: Fedor Ivanov <[email protected]>

---------

Co-authored-by: Maxim Filonov <[email protected]>
Co-authored-by: Fedor Ivanov <[email protected]>
  • Loading branch information
3 people authored Mar 21, 2024
1 parent b80c3a2 commit d1a81d8
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 9 deletions.
15 changes: 7 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
## Contributing
# Contributing

1. Fork it ( <https://github.com/blockscout/blockscout/fork> )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Write tests that cover your work
4. Commit your changes (`git commit -am 'Add some feature'`)
5. Push to the branch (`git push origin my-new-feature`)
6. Create a new Pull Request
7. Update CHANGELOG.md with the link to PR and description of the changes
6. Create a new Pull Request. The title of Pull Request should follow [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and should start with `feat:`, `fix:`, `chore:`, `doc:`, `perf:`, `refactor:` prefix.

### General
## General

* Commits should be one logical change that still allows all tests to pass. Prefer smaller commits if there could be two levels of logic grouping. The goal is to allow contributors in the future (including your own future self) to determine your reasoning for making changes and to allow them to cherry-pick, patch or port those changes in isolation to other branches or forks.
* If during your PR you reveal a pre-existing bug:
Expand All @@ -18,14 +17,14 @@
2. Commit the fix for the bug.
3. Continue original PR work.

### Enhancements
## Enhancements

Enhancements cover all changes that make users lives better:

* [feature requests filed as issues](https://github.com/blockscout/blockscout/labels/enhancement) that impact end-user [contributors](https://github.com/blockscout/blockscout/labels/contributor) and [developers](https://github.com/blockscout/blockscout/labels/developer)
* changes to the [architecture](https://github.com/blockscout/blockscout/labels/architecture) that make it easier for contributors (in the GitHub sense), dev-ops, and deployers to maintain and run blockscout

### Bug Fixes
## Bug Fixes

For bug fixes, whenever possible, there should be at least 2 commits:

Expand All @@ -34,7 +33,7 @@ For bug fixes, whenever possible, there should be at least 2 commits:

This format ensures that we can run the test to reproduce the original bug without depending on the new code in the fix, which could lead to the test falsely passing.

### Incompatible Changes
## Incompatible Changes

Incompatible changes can arise as a side-effect of either Enhancements or Bug Fixes. During Enhancements, incompatible changes can occur because, as an example, in order to support showing end-users new data, the database schema may need to be changed and the index rebuilt from scratch. During bug fixes, incompatible changes can occur because in order to fix a bug, the schema had to change, or how certain internal APIs are called changed.

Expand All @@ -45,7 +44,7 @@ Incompatible changes can arise as a side-effect of either Enhancements or Bug Fi
**NOTE**: A database reset and re-index is required
```

### Pull Request
## Pull Request

There is a [PULL_REQUEST_TEMPLATE.md](PULL_REQUEST_TEMPLATE.md) for this repository, but since it can't fill in the title for you, please follow the following steps when opening a Pull Request before filling in the template:

Expand Down
1 change: 0 additions & 1 deletion PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

## Checklist for your Pull Request (PR)

- [ ] I added an entry to `CHANGELOG.md` with this PR
- [ ] If I added new functionality, I added tests covering it.
- [ ] If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
- [ ] I checked whether I should update the docs and did so by submitting a PR to https://github.com/blockscout/docs
Expand Down
84 changes: 84 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# git-cliff ~ default configuration file
# https://git-cliff.org/docs/configuration
#
# Lines starting with "#" are comments.
# Configuration options are organized into tables and keys.
# See documentation for more information on available options.

[changelog]
# changelog header
header = """
# Changelog\n
"""
body = """
{% if version %}\
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## Current
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits %}
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message | upper_first }}\
{% endfor %}
{% endfor %}\n
"""
# template for the changelog footer
footer = """
<!-- generated by git-cliff -->
"""
# remove the leading and trailing s
trim = true
# postprocessors
postprocessors = [
# { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL
]

[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = false
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
# Replace issue numbers
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/blockscout/blockscout/issues/${2}))"},
# Check spelling of the commit with https://github.com/crate-ci/typos
# If the spelling is incorrect, it will be automatically fixed.
#{ pattern = '.*', replace_command = 'typos --write-changes -' },
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "(?i)^feat", group = "<!-- 0 -->🚀 Features" },
{ message = "(?i)^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
{ message = "(?i)^doc", group = "<!-- 3 -->📚 Documentation" },
{ message = "(?i)^perf", group = "<!-- 4 -->⚡ Performance" },
{ message = "(?i)^refactor", group = "<!-- 2 -->🚜 Refactor" },
{ message = "(?i)^chore\\(release\\): prepare for", skip = true },
{ message = "(?i)^chore\\(deps.*\\)", skip = true },
{ message = "(?i)^chore\\(pr\\)", skip = true },
{ message = "(?i)^chore\\(pull\\)", skip = true },
{ message = "(?i)^chore|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = true
# regex for matching git tags
# tag_pattern = "v[0-9].*"
# regex for skipping tags
# skip_tags = ""
# regex for ignoring tags
# ignore_tags = ""
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "newest"
# limit the number of commits included in the changelog.
# limit_commits = 42

0 comments on commit d1a81d8

Please sign in to comment.