You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ci: introduce towncrier to generate changelog from fragments (#4573)
* introduce towncrier to generate changelog from fragments
Replace manual CHANGELOG.md editing with towncrier fragment-based changelog
management. Each PR adds a small text file in .changelog/ instead of editing
the changelog directly, eliminating merge conflicts.
Root .changelog/ is used for coordinated releases (most packages).
Per-package .changelog/ dirs are used for independently released packages
(opamp-client, propagator-aws-xray, resource-detector-azure, sdk-extension-aws).
Changes:
- Add towncrier config to root pyproject.toml and 4 independent package
pyproject.toml files
- Add shared Jinja2 template at scripts/changelog_template.j2
- Replace sed-based changelog generation with towncrier build in all
release workflows (coordinated + per-package)
- Rewrite changelog CI to use towncrier check for fragment validation
- Add do-not-edit comments and towncrier markers to all CHANGELOG.md files
- Update CONTRIBUTING.md with changelog fragment guidance
- Update RELEASING.md to reflect towncrier workflow
- Add towncrier to dev dependencies
Assisted-by: Claude Opus 4.6
* address review: drop towncrier explanation, add changelog backport
- Remove towncrier explanation sentence from RELEASING.md (per @xrmx)
- Add changelog backport step to prepare-patch-release.yml to sync
changelog from release branch to main (per @emdneto, matching core)
Assisted-by: Claude Opus 4.6
---------
Co-authored-by: Aaron Abbott <aaronabbott@google.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,23 @@
2
2
3
3
All notable changes to this project will be documented in this file.
4
4
5
+
<!--
6
+
Do *NOT* add changelog entries here!
7
+
8
+
This changelog is managed by towncrier and is compiled at release time.
9
+
10
+
See https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/CONTRIBUTING.md#changelog for details.
11
+
-->
12
+
5
13
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
14
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
15
8
16
> [!NOTE]
9
17
> The following components are released independently and maintain individual CHANGELOG files.
10
18
> Use [this search for a list of all CHANGELOG.md files in this repo](https://github.com/search?q=repo%3Aopen-telemetry%2Fopentelemetry-python-contrib+path%3A**%2FCHANGELOG.md&type=code).
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+37-1Lines changed: 37 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -247,10 +247,46 @@ A PR is considered to be **ready to merge** when:
247
247
reasonable time to review.
248
248
* Trivial change (typo, cosmetic, doc, etc.) doesn't have to wait for one day.
249
249
* Urgent fix can take exception as long as it has been actively communicated.
250
-
* A changelog entry is added to the corresponding changelog for the code base, if there is any impact on behavior. e.g. doc entries are not required, but small bug entries are.
250
+
* A changelog fragment is added (see [Changelog](#changelog) below), if there is any impact on behavior. e.g. doc entries are not required, but small bug entries are.
251
251
252
252
Any Approver / Maintainer can merge the PR once it is **ready to merge**.
253
253
254
+
### Changelog
255
+
256
+
This project uses [towncrier](https://towncrier.readthedocs.io/) to manage changelogs. Instead of editing `CHANGELOG.md` directly, each PR should include a changelog fragment file.
257
+
258
+
**Where to add fragments:**
259
+
260
+
-**Coordinated packages** (most instrumentations, exporters, propagators): add to the root `.changelog/` directory
261
+
-**Independently released packages** (`opentelemetry-opamp-client`, `opentelemetry-propagator-aws-xray`, `opentelemetry-resource-detector-azure`, `opentelemetry-sdk-extension-aws`): add to `<package>/.changelog/`
262
+
263
+
**Creating a changelog fragment:**
264
+
265
+
Create a file named `.changelog/<PR_NUMBER>.<TYPE>` where `TYPE` is one of: `added`, `changed`, `deprecated`, `removed`, `fixed`.
266
+
267
+
The file should contain a one-line description of the change. For example, `.changelog/1234.fixed`:
268
+
269
+
```
270
+
`opentelemetry-instrumentation-flask`: fix request hook not being called for websocket connections
271
+
```
272
+
273
+
**Writing a good changelog entry:**
274
+
275
+
- Write in imperative tone, as if completing the phrase "This change will..."
276
+
- Keep entries concise — ideally under 80 characters
277
+
- Prefix with the affected package name (e.g. `` `opentelemetry-instrumentation-flask`: ... ``)
278
+
- Don't include the PR number — towncrier adds it automatically
279
+
280
+
**Preview the changelog:**
281
+
282
+
```console
283
+
towncrier build --draft --version Unreleased
284
+
```
285
+
286
+
The CI will verify that a changelog fragment exists and that `CHANGELOG.md` files are not directly modified.
287
+
288
+
If your change does not need a changelog entry, add the "Skip Changelog" label to the PR.
289
+
254
290
### Stale PRs
255
291
256
292
PRs with no activity for 14 days will be automatically marked as stale and closed after a further 14 days of inactivity. To prevent a PR from being marked stale, ensure there is regular activity (commits, comments, reviews, etc).
Copy file name to clipboardExpand all lines: RELEASING.md
+1-7Lines changed: 1 addition & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,11 +46,7 @@ To keep the process lightweight, it's OK to approve the PRs you generate and mer
46
46
47
47
### Backporting
48
48
49
-
Creating manual backports of pull request(s) requires the `backport` label to be added in order to have a green CI. Even if there where
50
-
no changes on a repo the patch release preparation workflow requires an empty `## Unreleased` header in `CHANGELOG.md`.
51
-
52
-
Backport of pull request(s) can be automated by a workflow only if there where no changes that will create conflicts in the release
53
-
branch, unfortunately every `CHANGELOG.md` change will create one.
49
+
Creating manual backports of pull request(s) requires the `backport` label to be added in order to have a green CI.
54
50
55
51
To use the workflow to backport pull request(s) to the release branch:
56
52
* Run the [Backport workflow](https://github.com/open-telemetry/opentelemetry-python-contrib/actions/workflows/backport.yml).
@@ -60,8 +56,6 @@ To use the workflow to backport pull request(s) to the release branch:
60
56
* Add the label `backport` to the generated pull request.
61
57
* In case label automation doesn't work, just close and reopen the PR so that the workflow will take into account the label automation we have in place.
62
58
* Review and merge the backport pull request that it generates.
63
-
* Merge a pull request to the release branch updating the `CHANGELOG.md`.
64
-
* The heading for the unreleased entries should be `## Unreleased`.
0 commit comments