Skip to content

Commit 262f70f

Browse files
authored
Add towncrier check in the CI (#329)
* Add towncrier check in the CI * add the changelog message to pass CI and validate change
1 parent adc009d commit 262f70f

File tree

5 files changed

+250
-4
lines changed

5 files changed

+250
-4
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,24 @@ jobs:
192192
GH_TOKEN: "${{ secrets.NTC_GITHUB_TOKEN }}"
193193
needs:
194194
- "pytest"
195+
changelog:
196+
if: >
197+
contains(fromJson('["develop"]'), github.base_ref) &&
198+
(github.head_ref != 'main') && (!startsWith(github.head_ref, 'release'))
199+
runs-on: "ubuntu-22.04"
200+
steps:
201+
- name: "Check out repository code"
202+
uses: "actions/checkout@v4"
203+
with:
204+
fetch-depth: "0"
205+
- name: "Setup environment"
206+
uses: "networktocode/gh-action-setup-poetry-environment@v6"
207+
with:
208+
poetry-version: "1.8.5"
209+
- name: "Check for changelog entry"
210+
run: |
211+
git fetch --no-tags origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
212+
poetry run towncrier check --compare-with origin/${{ github.base_ref }}
195213
publish_pypi:
196214
name: "Push Package to PyPI"
197215
runs-on: "ubuntu-24.04"

changes/329.housekeeping

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add changelog check in the CI

poetry.lock

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

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ types-pytz = "^2022.0.0"
5858
types-toml = "^0.10.1"
5959
netconan = "^0.12.3"
6060
toml = "0.10.2"
61+
towncrier = "^24.8.0"
6162
types-chardet = "^5.0.4"
6263
pandas-stubs = "2.2.2.240603"
6364
coverage = "^7.6.12"
@@ -144,7 +145,7 @@ addopts = "-vv --doctest-modules -p no:warnings --ignore-glob='*mock*'"
144145
package = "circuit_maintenance_parser"
145146
directory = "changes"
146147
filename = "docs/release_notes.md"
147-
template = "changes/towncrier_template.j2"
148+
template = "towncrier_template.j2"
148149
start_string = "<!-- towncrier release notes start -->"
149150
issue_format = "[#{issue}](https://github.com/networktocode/circuit_maintenance_parser/issues/{issue})"
150151

towncrier_template.j2

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
# v{{ versiondata.version.split(".")[:2] | join(".") }} Release Notes
3+
4+
This document describes all new features and changes in the release. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5+
6+
## Release Overview
7+
8+
- Major features or milestones
9+
- Changes to compatibility with Nautobot and/or other apps, libraries etc.
10+
11+
{% if render_title %}
12+
## [v{{ versiondata.version }} ({{ versiondata.date }})](https://github.com/networktocode/circuit_maintenance_parser/releases/tag/v{{ versiondata.version}})
13+
14+
{% endif %}
15+
{% for section, _ in sections.items() %}
16+
{% if sections[section] %}
17+
{% for category, val in definitions.items() if category in sections[section] %}
18+
{% if sections[section][category]|length != 0 %}
19+
### {{ definitions[category]['name'] }}
20+
21+
{% if definitions[category]['showcontent'] %}
22+
{% for text, values in sections[section][category].items() %}
23+
{% for item in text.split('\n') %}
24+
{% if values %}
25+
- {{ values|join(', ') }} - {{ item.strip() }}
26+
{% else %}
27+
- {{ item.strip() }}
28+
{% endif %}
29+
{% endfor %}
30+
{% endfor %}
31+
32+
{% else %}
33+
- {{ sections[section][category]['']|join(', ') }}
34+
35+
{% endif %}
36+
{% endif %}
37+
{% endfor %}
38+
{% else %}
39+
No significant changes.
40+
41+
{% endif %}
42+
{% endfor %}

0 commit comments

Comments
 (0)