跳到正文
DEV Community· Robin Beraud-Sudreau·· 3 小時前AI 評分53

Hermes skill changelog-from-git 從 Git log 生成發佈説明,毋須 changelog 工具

Release notes from git log, without a changelog tool

AI 導讀

Robin Beraud-Sudreau 編寫的 Hermes skill `changelog-from-git`,可從 Git 提交紀錄按 Conventional Commit 類型生成發佈説明。

正文

Robin Beraud-Sudreau

Writing release notes by scrolling through git log is slow and easy to get wrong. You skip a fix, you forget which change breaks users, and the notes end up as a raw list of commit hashes.

I wrote a small Hermes skill, changelog-from-git, that does the boring part. It is one Python file using only the standard library, plus git. No API key, no network.

It finds the latest tag (or takes --from and --to), reads the commits in that range, and groups them by Conventional Commit type: features, fixes, docs, and so on. A ! after the type, or a BREAKING CHANGE footer, moves the entry to a "Breaking changes" section at the top. PR numbers such as (#12) are kept. Commits that do not follow the convention are not guessed at: they go under "Other changes", which also tells you how tidy your history is.

python3 scripts/changelog.py --repo . --from v1.3.0 --title "v1.4.0" > CHANGES.md

Output looks like this:

### Features
- **api:** Add search endpoint (#12) [609795f]
### Fixes
- Handle empty input [291d6d7]

The script has a --selftest that builds a temporary repo, makes a few commits after a tag and checks the result.

Limits: it reads commit messages only, so it does not pull PR titles from GitHub, and squash-merge repos only get PR numbers if they are in the subject. Review the output before you publish it.


Skill (MIT): https://github.com/RobinBeraud/hermes-skills/tree/main/software-development/changelog-from-git
All skills: https://github.com/RobinBeraud/hermes-skills

This post was written with AI assistance and reviewed through automated checks.

來源:DEV Community · dev.to