Principle:Langchain ai Langchain Release Notes Generation
Overview
Release Notes Generation is the practice of automatically producing a human-readable changelog from the version control history between two release points.
Description
Rather than requiring maintainers to manually author release notes, this pattern derives them from the commit log. The process works by:
- Identifying the previous release tag for the same package.
- Collecting all commits between that tag and the current
HEADthat touched files in the package's directory. - Formatting the commit subjects into a list that becomes the release body.
This approach ensures that release notes are always complete and consistent with the actual changes shipped. It also removes the human effort of manually tracking which commits belong to which release -- especially important in a monorepo where many packages share the same commit history.
For pre-release versions (containing a hyphen, e.g., 1.0.0-rc1), the previous tag resolution logic differs: it first looks for a tag matching the base version, then falls back to the most recent stable release tag.
Usage
Use automatic release notes generation when:
- Cutting any release (stable or pre-release) to populate the GitHub Release body.
- Auditing what changes are included in a particular release.
- Generating changelogs for documentation.
Practical Guide
1. Determine the current package name and version.
2. Compute the tag for the previous release:
a. For stable: decrement the patch version.
b. For pre-release: find the matching base version tag, or latest stable.
c. Fallback: find the most recent tag matching the package name.
3. Validate that the previous tag exists in the repository.
4. Run: git log --format="%s" "$PREV_TAG"..HEAD -- $PACKAGE_DIR
5. Prepend a preamble ("Changes since <prev_tag>" or "Initial release").
6. Emit as the release body.
Pseudocode:
prev_tag = find_previous_tag(pkg_name, version)
if prev_tag is None:
preamble = "Initial release"
prev_ref = first_commit_in_repo()
else:
preamble = "Changes since " + prev_tag
commits = git_log(format="%s", range=prev_ref + "..HEAD", path=package_dir)
release_body = preamble + "\n\n" + commits