introducing towncrier to generate changelog from fragments
#4382
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: