Skip to content

Commit 397aea1

Browse files
committed
ci: changelog
1 parent c89d5a6 commit 397aea1

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed

.github/workflows/changelog.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: changelog
2+
on: release
3+
4+
jobs:
5+
changelog-gen:
6+
name: Generate changelog
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v2
11+
with:
12+
fetch-depth: 0
13+
14+
- uses: orhun/git-cliff-action@v1
15+
with:
16+
config: cliff.toml
17+
args: -vv --latest --strip header -c .github/workflows/cliff.toml
18+
env:
19+
OUTPUT: CHANGELOG.md
20+
21+
- name: Print the changelog
22+
run: cat "${{ steps.git-cliff.outputs.changelog }}"

.github/workflows/cliff.toml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# configuration file for git-cliff (0.1.0)
2+
3+
[changelog]
4+
# changelog header
5+
header = """
6+
# Changelog\n
7+
All notable changes to this project will be documented in this file.\n
8+
"""
9+
# template for the changelog body
10+
# https://tera.netlify.app/docs/#introduction
11+
body = """
12+
{% if version %}\
13+
## [{{ version | trim_start_matches(pat="v") }}]
14+
{% else %}\
15+
## [unreleased]
16+
{% endif %}\
17+
{% for group, commits in commits | group_by(attribute="group") %}
18+
### {{ group | upper_first }}
19+
{% for commit in commits
20+
| filter(attribute="scope")
21+
| sort(attribute="scope") %}
22+
- {% if commit.breaking %}[**breaking**] {% endif %}_({{commit.scope}})_ {{ commit.message }}
23+
{%- endfor %}
24+
{% for commit in commits %}
25+
{%- if commit.scope -%}
26+
{% else -%}
27+
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }}
28+
{% endif -%}
29+
{% endfor -%}
30+
{% raw %}{% endraw %}\
31+
{% endfor %}\n
32+
"""
33+
# remove the leading and trailing whitespaces from the template
34+
trim = true
35+
# changelog footer
36+
footer = """
37+
<!-- generated by git-cliff -->
38+
"""
39+
40+
[git]
41+
# allow only conventional commits
42+
# https://www.conventionalcommits.org
43+
conventional_commits = true
44+
# filter out the commits that are not conventional
45+
filter_unconventional = true
46+
# regex for parsing and grouping commits
47+
commit_preprocessors = [
48+
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/lunarvim/lunarvim/pull/${2}))" },
49+
]
50+
commit_parsers = [
51+
{ message = "(.*[bB]ump)", group = "<!-- 7 --> Miscellaneous Tasks", skip = true },
52+
{ message = "^[bB]uild", group = "<!-- 0 --> Packaging" },
53+
{ message = "(^[fF]eat|^\\[Feat)", group = "<!-- 1 --> Features" },
54+
{ message = "(^[bB]ug|^[Ff]ix|^\\[Bug)", group = "<!-- 2 --> Bugfix" },
55+
{ message = "(^[rR]efactor|^ref)", group = "<!-- 3 --> Refactor" },
56+
{ message = "^[dD]oc", group = "<!-- 4 --> Documentation" },
57+
{ message = "^[rR]evert", group = "<!-- 5 --> Revert" },
58+
{ message = "^[pP]erf", group = "<!-- 6 --> Performance" },
59+
{ message = "^[cC]hore", group = "<!-- 7 --> Miscellaneous Tasks", skip = true },
60+
{ message = "^ci", group = "<!-- 7 --> Miscellaneous Tasks", skip = true },
61+
{ message = "^test", group = "<!-- 7 --> Miscellaneous Tasks", skip = true },
62+
{ message = "[wW]orkflow", group = "<!-- 7 --> Miscellaneous Tasks", skip = true },
63+
]
64+
# filter out the commits that are not matched by commit parsers
65+
filter_commits = false
66+
# glob pattern for matching git tags
67+
tag_pattern = "v[0-9]*"
68+
# regex for skipping tags
69+
skip_tags = "v0.1.0-beta.1"
70+
# regex for ignoring tags
71+
ignore_tags = ""
72+
# sort the tags topologically
73+
topo_order = false
74+
# sort the commits inside sections by oldest/newest order
75+
sort_commits = "oldest"
76+
# protect breaking changes from being skipped due to matching a skipping commit_parser
77+
protect_breaking_commits = false
78+
79+
[features]
80+
preserve_order = ["serde_json/preserve_order"]

0 commit comments

Comments
 (0)