Skip to content

Commit 820add9

Browse files
committed
chore(changelog): Use towncrier to generate release changelogs
1 parent a010288 commit 820add9

File tree

9 files changed

+291
-18
lines changed

9 files changed

+291
-18
lines changed

.github/PULL_REQUEST_TEMPLATE/feature_branch_pr_template.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ What was the motivation for the changes in this PR?
88

99
### Checklist
1010

11-
- [ ] If you are requesting a merge into `master`, confirm this code is production-ready and can be included in future releases as soon as it gets merged
11+
- [ ] If you are requesting a merge into `master`, confirm this code is production-ready and can be included in future releases as soon as it gets merged
12+
- [ ] Added changelog fragment OR added `skip-changelog` label

.github/workflows/main.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,27 @@ jobs:
7777
restore-keys: |
7878
${{ runner.os }}-py${{ matrix.python }}-mypy-refs/heads/dev-
7979
${{ runner.os }}-py${{ matrix.python }}-mypy-
80+
- name: Check for changelog fragment
81+
env:
82+
SKIP_CHANGELOG: ${{ contains(github.event.pull_request.labels.*.name, 'skip-changelog') }}
83+
run: |
84+
# Skip if 'skip-changelog' label present
85+
if [[ "$SKIP_CHANGELOG" == "true" ]]; then
86+
echo "Skipping due to skip-changelog label"
87+
exit 0
88+
fi
89+
90+
PR=${{ github.event.pull_request.number }}
91+
if ls changelogs/unreleased/${PR}.*.md 1> /dev/null 2>&1; then
92+
echo "Found changelog fragment for PR #${PR}"
93+
else
94+
echo "::error::Missing changelog fragment: changelogs/unreleased/${PR}.<type>.md"
95+
echo "Valid types: breaking, security, feat, fix, perf, deprecation, docs, misc"
96+
echo "Or add 'skip-changelog' label to skip this check."
97+
exit 1
98+
fi
99+
- name: Validate towncrier config
100+
run: towncrier build --draft --version "test" > /dev/null
80101
- name: Run linters
81102
run: poetry run make check
82103
- name: Run tests

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6+
7+
<!-- towncrier release notes start -->

changelogs/TEMPLATE.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<!--
2+
CHANGELOG FRAGMENT TEMPLATE
3+
============================
4+
5+
HOW TO USE:
6+
1. Copy this file to: changelogs/unreleased/<PR_NUMBER>.<type>.md
7+
Example: changelogs/unreleased/1234.feat.md
8+
9+
2. Choose <type> based on your change (matches semantic commit prefixes):
10+
- feature → New user-facing features
11+
- fix → Bug fixes for users
12+
- docs → Documentation changes
13+
- style → Formatting, no code change (hidden from public changelog)
14+
- refactor → Refactoring production code
15+
- test → Test changes, no production code (hidden from public changelog)
16+
- chore → Admin/build/config changes (hidden from public changelog)
17+
18+
Note: Breaking changes should be noted in the fragment description, not as a separate type.
19+
20+
3. Replace this entire comment block with your changelog entry.
21+
Write a concise, user-facing description of the change.
22+
23+
EXAMPLES:
24+
25+
Simple feature (feature):
26+
Add rate limiting support for API endpoints
27+
28+
Bug fix (fix):
29+
Fix WebSocket reconnection failing after timeout
30+
31+
Refactoring (refactor):
32+
Simplify transaction validation logic
33+
34+
Breaking change (feature with migration note):
35+
Rename `get_tx()` to `get_vertex()` in storage API
36+
37+
**BREAKING:** Replace all calls to `storage.get_tx(hash)`
38+
with `storage.get_vertex(hash)`
39+
40+
With code examples (feature with breaking change):
41+
Change configuration format from YAML to TOML
42+
43+
**BREAKING:**
44+
```yaml
45+
# Before (config.yml)
46+
server:
47+
port: 8080
48+
```
49+
```toml
50+
# After (config.toml)
51+
[server]
52+
port = 8080
53+
```
54+
55+
GUIDELINES:
56+
- Write for end users, not developers
57+
- Focus on impact, not implementation details
58+
- For breaking changes, always include migration steps
59+
- Keep it concise: 1-2 sentences for simple changes
60+
-->
61+
62+
Your changelog entry here
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add changelog fragment support using towncrier

changelogs/unreleased/fix-output-negative-value.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

changelogs/unreleased/fix-ws-notification-broadcast.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

poetry.lock

Lines changed: 155 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ yamllint = "~1.35.1"
5151
types-requests = "=2.28.11.4"
5252
types-pyopenssl = "=22.1.0.2"
5353
types-pyyaml = "=6.0.12.9"
54+
towncrier = "~23.11.0"
5455

5556
[tool.poetry.dependencies]
5657
python = ">=3.11,<4"
@@ -185,3 +186,45 @@ norecursedirs = ["hathor_tests/nanocontracts/test_blueprints"]
185186
[build-system]
186187
requires = ["poetry-core >= 1.3.2", "cython < 0.30"]
187188
build-backend = "poetry.core.masonry.api"
189+
190+
[tool.towncrier]
191+
package = "hathor"
192+
filename = "CHANGELOG.md"
193+
directory = "changelogs/unreleased"
194+
title_format = "## [{version}] - {project_date}"
195+
issue_format = "[#{issue}](https://github.com/HathorNetwork/hathor-core/pull/{issue})"
196+
197+
[[tool.towncrier.type]]
198+
directory = "feature"
199+
name = "Features"
200+
showcontent = true
201+
202+
[[tool.towncrier.type]]
203+
directory = "fix"
204+
name = "Bug Fixes"
205+
showcontent = true
206+
207+
[[tool.towncrier.type]]
208+
directory = "docs"
209+
name = "Documentation"
210+
showcontent = true
211+
212+
[[tool.towncrier.type]]
213+
directory = "style"
214+
name = "Style"
215+
showcontent = false
216+
217+
[[tool.towncrier.type]]
218+
directory = "refactor"
219+
name = "Refactoring"
220+
showcontent = true
221+
222+
[[tool.towncrier.type]]
223+
directory = "test"
224+
name = "Tests"
225+
showcontent = false
226+
227+
[[tool.towncrier.type]]
228+
directory = "chore"
229+
name = "Chores"
230+
showcontent = false

0 commit comments

Comments
 (0)