Skip to content

Commit f80e2c3

Browse files
Create changelog.yml
1 parent 401d208 commit f80e2c3

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.github/workflows/changelog.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Generate Changelog
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
changelog:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Generate changelog
18+
id: git-cliff
19+
uses: orhun/git-cliff-action@v3
20+
with:
21+
args: "-o CHANGELOG.md"
22+
env:
23+
GIT_CLIFF_CONFIG: |
24+
[changelog]
25+
header = """
26+
# Changelog\n
27+
All notable changes to this project will be documented in this file.\n
28+
"""
29+
body = """
30+
{% if version %}\
31+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
32+
{% else %}\
33+
## [unreleased]
34+
{% endif %}\
35+
{% for group, commits in commits | group_by(attribute="group") %}
36+
### {{ group | upper_first }}
37+
{% for commit in commits %}
38+
- {% if commit.scope %}(**{{ commit.scope }}**) {% endif %}{{ commit.message | upper_first }} ([`{{ commit.id | truncate(length=7, end="") }}`](https://github.com/${{ github.repository }}/commit/{{ commit.id }}))\
39+
{% endfor %}
40+
{% endfor %}\n
41+
"""
42+
trim = true
43+
footer = ""
44+
45+
[git]
46+
conventional_commits = true
47+
filter_unconventional = true
48+
split_commits = false
49+
commit_parsers = [
50+
{ message = "^feat", group = "Features" },
51+
{ message = "^fix", group = "Bug Fixes" },
52+
{ message = "^doc", group = "Documentation" },
53+
{ message = "^style", group = "Styling" },
54+
{ message = "^refactor", group = "Refactoring" },
55+
{ message = "^perf", group = "Performance" },
56+
{ message = "^test", group = "Testing" },
57+
{ message = "^chore\\(release\\):", skip = true },
58+
{ message = "^chore", group = "Miscellaneous Tasks" },
59+
{ body = ".*security", group = "Security" },
60+
]
61+
protect_breaking_commits = false
62+
filter_commits = false
63+
tag_pattern = "v[0-9]*"
64+
skip_tags = "v0.1.0-beta.1"
65+
ignore_tags = ""
66+
sort_commits = "oldest"
67+
68+
- name: Commit and push changelog
69+
uses: stefanzweifel/git-auto-commit-action@v5
70+
with:
71+
commit_message: "chore(release): update changelog"
72+
file_pattern: "CHANGELOG.md"
73+
commit_user_name: "github-actions[bot]"
74+
commit_user_email: "github-actions[bot]@users.noreply.github.com"
75+
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"

0 commit comments

Comments
 (0)