Skip to content

Commit 53938d5

Browse files
feat: add cliff workflow
1 parent 45f0638 commit 53938d5

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed

β€Ž.github/workflows/cliff.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Generate Changelog
2+
on:
3+
release:
4+
types: [published]
5+
branches: [master]
6+
permissions:
7+
contents: write
8+
env:
9+
GH_TOKEN: ${{ github.token }}
10+
jobs:
11+
generate_changelog:
12+
runs-on: ubuntu-latest
13+
name: Generate Changelog
14+
steps:
15+
- name: Check out repository
16+
uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Generate a changelog
21+
uses: orhun/git-cliff-action@v3
22+
with:
23+
config: cliff.toml
24+
args: --verbose --latest
25+
env:
26+
OUTPUT: CHANGELOG.md
27+
GITHUB_REPO: ${{ github.repository }}
28+
29+
- name: Add changelog to release
30+
run: gh release edit ${{ github.event.release.tag_name }} -F CHANGELOG.md

β€Žcliff.toml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# git-cliff ~ default configuration file
2+
# https://git-cliff.org/docs/configuration
3+
#
4+
# Lines starting with "#" are comments.
5+
# Configuration options are organized into tables and keys.
6+
# See documentation for more information on available options.
7+
8+
[changelog]
9+
# template for the changelog body
10+
# https://keats.github.io/tera/docs/#introduction
11+
body = """
12+
# Changelog
13+
14+
{% if version %}\
15+
**Full Commit Log**: <REPO>/commits/{{ version }}\n
16+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
17+
{% else %}\
18+
## [unreleased]
19+
{% endif %}\
20+
{% for group, commits in commits | group_by(attribute="group") %}
21+
### {{ group | striptags | trim | upper_first }}
22+
{% for commit in commits %}
23+
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
24+
{% if commit.breaking %}[**breaking**] {% endif %}\
25+
{{ commit.message | upper_first }}\
26+
{% endfor %}
27+
{% endfor %}\n
28+
"""
29+
30+
# remove the leading and trailing s
31+
trim = true
32+
# postprocessors
33+
postprocessors = [
34+
{ pattern = '<REPO>', replace = "https://github.com/kcoderhtml/hackatime" }, # replace repository URL
35+
]
36+
37+
[git]
38+
# parse the commits based on https://www.conventionalcommits.org
39+
conventional_commits = true
40+
# filter out the commits that are not conventional
41+
filter_unconventional = true
42+
# process each line of a commit as an individual commit
43+
split_commits = false
44+
# regex for parsing and grouping commits
45+
commit_parsers = [
46+
{ message = "^feat", group = "<!-- 0 -->πŸš€ Features" },
47+
{ message = "^fix", group = "<!-- 1 -->πŸ› Bug Fixes" },
48+
{ message = "^doc", group = "<!-- 3 -->πŸ“š Documentation" },
49+
{ message = "^perf", group = "<!-- 4 -->⚑ Performance" },
50+
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
51+
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
52+
{ message = "^test", group = "<!-- 6 -->πŸ§ͺ Testing" },
53+
{ message = "^chore\\(release\\): prepare for", skip = true },
54+
{ message = "^chore\\(deps.*\\)", skip = true },
55+
{ message = "^chore\\(pr\\)", skip = true },
56+
{ message = "^chore\\(pull\\)", skip = true },
57+
{ message = "^chore|^ci", group = "<!-- 7 -->βš™οΈ Miscellaneous Tasks" },
58+
{ body = ".*security", group = "<!-- 8 -->πŸ›‘οΈ Security" },
59+
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
60+
]
61+
# protect breaking changes from being skipped due to matching a skipping commit_parser
62+
protect_breaking_commits = false
63+
# filter out the commits that are not matched by commit parsers
64+
filter_commits = false
65+
# regex for matching git tags
66+
# tag_pattern = "v[0-9].*"
67+
# regex for skipping tags
68+
# skip_tags = ""
69+
# regex for ignoring tags
70+
# ignore_tags = ""
71+
# sort the tags topologically
72+
topo_order = false
73+
# sort the commits inside sections by oldest/newest order
74+
sort_commits = "oldest"
75+
# limit the number of commits included in the changelog.
76+
# limit_commits = 42

0 commit comments

Comments
Β (0)