introducing towncrier to generate changelog from fragments#4382
Closed
emdneto wants to merge 1 commit into
Closed
Conversation
Signed-off-by: emdneto <[email protected]>
emdneto
marked this pull request as ready for review
January 9, 2025 13:37
emdneto
commented
Jan 9, 2025
| --head $branch \ | ||
| --base $GITHUB_REF_NAME | ||
|
|
||
| - uses: actions/checkout@v4 |
Member
Author
There was a problem hiding this comment.
We can probably leave this for another PR to not introduce too many changes at this moment
|
This PR has been automatically marked as stale because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 days of this comment. |
|
This PR has been closed due to inactivity. Please reopen if you would like to continue working on it. |
7 tasks
MikeGoldsmith
added a commit
to MikeGoldsmith/opentelemetry-python
that referenced
this pull request
May 8, 2026
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. Changes: - Add towncrier configuration in pyproject.toml with 5 fragment types (added, changed, deprecated, removed, fixed) - Replace sed-based changelog generation in release workflows with towncrier build - Add changelog backport step to patch release workflow - Update CI to use towncrier check for fragment validation - Add pre-commit check via scripts/check_changelog_fragment.py - Add tox environments: changelog (preview) and new-changelog (create) - Add contributor documentation in CONTRIBUTING.md - Convert existing unreleased entries to fragment files - Add custom Jinja2 template for changelog output Based on the proof-of-concept in open-telemetry#4382 by @emdneto. Co-authored-by: Emídio Neto <[email protected]> Assisted-by: Claude Opus 4.6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #4307
Hopefully, also Fix #4309
Description
Towncrier is a tool adopted in some well-known python projects to generate release notes from fragments. In otel-python we are always dealing with
CHANGELOG.mdconflicts during rebases, specially after releases. So, this can help us with it since now we have a changelog entry for each PR in the.changelogdirectory. This is similar tochloggenadopted inopentelemetry-collector.How it works:
Creating a Changelog Fragment:
.changelogdirectory in the format<PR_NUMBER>.<CATEGORY>, where<CATEGORY>can beadded,changed,fixed, etc.#1234fixing a bug would create a file named./.changelog/1234.fixedcontaining a short description of the change.Releasing:
towncrier build --yes. This command:.changelogdirectory.CHANGELOG.mdwith the generated content.The configuration is pretty simple and we can customize the changelog as we want using jinja templates and also customize the category names.
I tested the changes using https://github.com/nektos/act:
act -W '.github/workflows/changelog.yml' --eventpath event.json{ "act": true, "env": { "GITHUB_REF_NAME": "main" }, "pull_request": { "number": 4371, "head": { "ref": "xyz", "sha": "1234567890abcdef1234567890abcdef12345678" }, "base": { "ref": "main" }, "user": { "login": "opentelemetrybot" } } }If you checkout this branch and run
towncrier build --yes --version=1.30.0/0.51b0The generated changelog for this branch will be: