Skip to content

Commit

Permalink
Merge pull request #2090 from cfpb/ans_git_cliff
Browse files Browse the repository at this point in the history
Switch to git-cliff from auto-changelog
  • Loading branch information
anselmbradford authored Nov 1, 2024
2 parents fddfbd4 + 3f6d1be commit 8bd2b3c
Show file tree
Hide file tree
Showing 17 changed files with 426 additions and 349 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
91 changes: 91 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# 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]
# template for the changelog header
header = """
# Changelog\n
All notable changes to this project will be documented in this file.\n
"""
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{% if version %}\
{% if previous.version %}\
## [{{ version | trim_start_matches(pat="v") }}](<REPO>/compare/{{ previous.version }}..{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% endif %}\
{% else %}\
## [unreleased]
{% 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 }} {% if commit.merge_commit == false %}- ([{{ commit.id | truncate(length=7, end="") }}](<REPO>/commit/{{ commit.id }})) {% endif %}- {{ commit.author.name }}\
{% endfor %}
{% endfor %}\n
"""
# template for the changelog footer
footer = ""
# remove the leading and trailing s
trim = true
# postprocessors
postprocessors = [
{ pattern = '<REPO>', replace = "https://github.com/cfpb/design-system" },
]
# render body even when there are no releases to process
# render_always = true
# output file path
# output = "test.md"

[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}](<REPO>/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 -' },
{ pattern = "Merge pull request #([0-9]+) from [^\n]+\n\n", replace = "PR #[${1}](https://github.com/cfpb/design-system/pull/${1}): "}
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^Release [0-9]+.[0-9]+.[0-9]", skip = true },
{ message = "^feat", group = "<!-- 1 -->🚀 Features" },
{ message = "^fix", group = "<!-- 2 -->🐛 Bug Fixes" },
{ message = "^refactor", group = "<!-- 3 -->🚜 Refactor" },
{ message = "^doc", group = "<!-- 4 -->📚 Documentation" },
{ message = "^perf", group = "<!-- 5 -->⚡ Performance" },
{ message = "^style", group = "<!-- 6 -->🎨 Styling" },
{ message = "^test", group = "<!-- 7 -->🧪 Testing" },
{ message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore\\(deps.*\\)", skip = true },
{ message = "^chore\\(pr\\)", skip = true },
{ message = "^chore\\(pull\\)", skip = true },
{ message = "^chore|^ci", group = "<!-- 8 -->⚙️ Miscellaneous Tasks" },
{ body = ".*security", group = "<!-- 9 -->🛡️ Security" },
{ message = "^revert", group = "<!-- 10 -->◀️ Revert" },
{ message = "^PR #", group = "<!-- 0 --> PRs in this release"},
{ message = ".*", group = "<!-- 11 --> General"},
]
# filter out the commits that are not matched by commit parsers
filter_commits = true
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"
# Skip older tags that are recorded in HISTORY.md
skip_tags = "^v[0-2]+.[0-9]+.[0-9]+$"
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"@cfpb/browserslist-config": "0.0.3",
"@csstools/postcss-sass": "5.1.1",
"@lhci/cli": "0.14.0",
"auto-changelog": "2.5.0",
"autoprefixer": "10.4.20",
"concurrently": "9.0.1",
"cypress": "13.15.1",
Expand All @@ -67,6 +66,7 @@
"eslint-plugin-jsdoc": "50.4.3",
"eslint-plugin-jsx-a11y": "6.10.2",
"eslint-plugin-react": "7.37.2",
"git-cliff": "2.6.1",
"glob": "11.0.0",
"globals": "15.11.0",
"http-server": "14.1.1",
Expand All @@ -89,12 +89,12 @@
"release-it": {
"git": {
"requireBranch": "main",
"changelog": "cd packages/cfpb-design-system && auto-changelog --stdout",
"changelog": "yarn exec git-cliff -o 'packages/cfpb-design-system/CHANGELOG.md' --include-path 'packages/cfpb-design-system/**/*'",
"commitsPath": "packages/cfpb-design-system",
"requireCommits": true
},
"hooks": {
"after:bump": "cd packages/cfpb-design-system && auto-changelog -p"
"after:bump": "yarn exec git-cliff -o 'packages/cfpb-design-system/CHANGELOG.md' --include-path 'packages/cfpb-design-system/**/*'"
},
"npm": {
"publish": false,
Expand Down
Loading

0 comments on commit 8bd2b3c

Please sign in to comment.