Skip to content

Commit a3cac9c

Browse files
committed
feat: re-add git-cliff using official marketplace action
Re-implemented automated changelog generation using the official git-cliff-action from GitHub Marketplace (verified). - Uses orhun/git-cliff-action@v4 (verified in marketplace) - Replaced peter-evans/create-pull-request with GitHub CLI - Added skip rule for dependency update commits - Maintains conventional commit parsing The workflow will automatically generate changelog updates and create PRs when commits are pushed to main.
1 parent 49a08ae commit a3cac9c

3 files changed

Lines changed: 140 additions & 0 deletions

File tree

.github/cliff.toml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Configuration for git-cliff changelog generator
2+
3+
[changelog]
4+
# Changelog header
5+
header = """
6+
# Changelog
7+
8+
All notable changes to Claude Code Telemetry will be documented in this file.
9+
10+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
11+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
12+
13+
"""
14+
# Template for the changelog body
15+
body = """
16+
{% if version %}\
17+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
18+
{% else %}\
19+
## [Unreleased]
20+
{% endif %}\
21+
22+
{% for group, commits in commits | group_by(attribute="group") %}
23+
### {{ group | upper_first }}
24+
{% for commit in commits %}
25+
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/lainra/claude-code-telemetry/commit/{{ commit.id }}))
26+
{%- endfor %}
27+
{% endfor %}\n
28+
"""
29+
# Changelog footer
30+
footer = """
31+
---
32+
Generated by [git-cliff](https://github.com/orhun/git-cliff)
33+
"""
34+
# Remove the leading and trailing whitespace from the template
35+
trim = true
36+
37+
[git]
38+
# Parse conventional commits
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 = "Features" },
47+
{ message = "^fix", group = "Bug Fixes" },
48+
{ message = "^doc", group = "Documentation" },
49+
{ message = "^perf", group = "Performance" },
50+
{ message = "^refactor", group = "Refactoring" },
51+
{ message = "^style", group = "Style" },
52+
{ message = "^test", group = "Testing" },
53+
{ message = "^chore\\(release\\): prepare for", skip = true },
54+
{ message = "^chore\\(deps.*\\)", skip = true },
55+
{ message = "^chore", group = "Miscellaneous Tasks" },
56+
{ body = ".*security", group = "Security" },
57+
]
58+
# Protect breaking changes from being skipped
59+
protect_breaking_commits = false
60+
# Filter out the commits that are not matched by commit parsers
61+
filter_commits = false
62+
# Sort commits by date
63+
sort_commits = "oldest"
64+
# Limit the number of commits to include in the changelog
65+
# limit_commits = 1000

.github/workflows/changelog.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Changelog
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
changelog:
14+
runs-on: ubuntu-latest
15+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Generate changelog
23+
uses: orhun/git-cliff-action@v4
24+
id: git-cliff
25+
with:
26+
config: .github/cliff.toml
27+
args: --verbose
28+
env:
29+
OUTPUT: CHANGELOG.md
30+
GITHUB_REPO: ${{ github.repository }}
31+
32+
- name: Check if changelog was updated
33+
id: git-diff
34+
run: |
35+
if git diff --exit-code CHANGELOG.md; then
36+
echo "changed=false" >> $GITHUB_OUTPUT
37+
else
38+
echo "changed=true" >> $GITHUB_OUTPUT
39+
fi
40+
41+
- name: Create Pull Request
42+
if: steps.git-diff.outputs.changed == 'true'
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
run: |
46+
# Configure git
47+
git config user.name "github-actions[bot]"
48+
git config user.email "github-actions[bot]@users.noreply.github.com"
49+
50+
# Create branch and commit
51+
BRANCH="update-changelog-$(date +%s)"
52+
git checkout -b "$BRANCH"
53+
git add CHANGELOG.md
54+
git commit -m "chore: update CHANGELOG.md"
55+
git push origin "$BRANCH"
56+
57+
# Create PR using GitHub CLI
58+
gh pr create \
59+
--title "chore: update CHANGELOG.md" \
60+
--body "## 📝 Automated Changelog Update
61+
62+
This PR updates the CHANGELOG.md file with the latest commits.
63+
64+
### Changes Made:
65+
- Updated CHANGELOG.md with recent commits
66+
- Organized by conventional commit types
67+
- Added links to commits and issues
68+
69+
---
70+
*This PR was automatically generated by the changelog workflow.*" \
71+
--base main \
72+
--head "$BRANCH"

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4242
### Revert
4343

4444
- Use peter-evans/create-pull-request action ([16816c6](https://github.com/lainra/claude-code-telemetry/commit/16816c662854b63f8dc42719a11081bf07af4a32))
45+
46+
---
47+
Generated by [git-cliff](https://github.com/orhun/git-cliff)

0 commit comments

Comments
 (0)