Implementation:Langchain ai Langchain Git Log Release Notes
Overview
Concrete tool for generating release notes from Git history, provided by the release-notes job in _release.yml using git log --format="%s".
Description
The release-notes job runs after the build job and produces the release body in two steps:
Step 1 -- Check Tags (lines 116-171): Computes the previous release tag for the package:
- For pre-release versions (containing a hyphen): looks for a tag matching the base version, then falls back to the most recent stable release tag.
- For stable versions: computes the previous patch version tag (e.g.,
langchain-core==1.2.10for version1.2.11). If the patch is0, falls back to the most recent tag. - Validates the computed previous tag exists in the Git repository.
- Aborts if the new tag would be identical to the previous tag.
Step 2 -- Generate Release Body (lines 172-193): Runs git log scoped to the package directory to collect commit subjects, prefixed with a preamble.
The job uses sparse checkout and fetch-depth: 0 to ensure full commit history is available while only checking out files for the relevant package directory.
Usage
This job runs automatically as part of the release pipeline. Its output (release-body) is consumed by the mark-release job to populate the GitHub Release description.
Code Reference
Source Location: .github/workflows/_release.yml (lines 99-193)
Previous Tag Computation (stable version):
# Compute previous patch version tag
PREV_TAG="$PKG_NAME==${VERSION%.*}.$(( ${VERSION##*.} - 1 ))"
# If patch is 0, look for latest tag
if [ -z "$PREV_TAG" ]; then
REGEX="^$PKG_NAME==\\d+\\.\\d+\\.\\d+\$"
PREV_TAG=$(git tag --sort=-creatordate | (grep -P $REGEX || true) | head -1)
fi
Previous Tag Computation (pre-release version):
BASE_VERSION=${VERSION%%-*}
REGEX="^$PKG_NAME==$BASE_VERSION\$"
PREV_TAG=$(git tag --sort=-creatordate | (grep -P "$REGEX" || true) | head -1)
# Fallback to latest stable if no base version tag
if [ -z "$PREV_TAG" ]; then
REGEX="^$PKG_NAME==\\d+\\.\\d+\\.\\d+\$"
PREV_TAG=$(git tag --sort=-creatordate | (grep -P "$REGEX" || true) | head -1)
fi
Release Body Generation:
PREAMBLE="Changes since $PREV_TAG"
if [ -z "$PREV_TAG" ] || [ "$PREV_TAG" = "$PKG_NAME==0.0.0" ]; then
PREAMBLE="Initial release"
PREV_TAG=$(git rev-list --max-parents=0 HEAD)
fi
{
echo 'release-body<<EOF'
echo $PREAMBLE
echo
git log --format="%s" "$PREV_TAG"..HEAD -- $WORKING_DIR
echo EOF
} >> "$GITHUB_OUTPUT"
Invocation: Automatic, as part of the release pipeline. Depends on build job outputs (pkg-name, version).
I/O Contract
| Direction | Name | Type | Description |
|---|---|---|---|
| Input | PKG_NAME | string | Package name from the build job (e.g., langchain-core)
|
| Input | VERSION | string | Version string from the build job (e.g., 1.2.11)
|
| Input | working-directory | string | Package directory for scoping the git log |
| Input | Git history | Repository | Full commit history (fetched with fetch-depth: 0)
|
| Output | tag | string | The new release tag (e.g., langchain-core==1.2.11)
|
| Output | prev-tag | string | The previous release tag (e.g., langchain-core==1.2.10)
|
| Output | release-body | string | The formatted release notes body |
Usage Examples
Example 1: Typical release notes output
Changes since langchain-core==1.2.10
fix(core): resolve type hinting issue in vector store
feat(core): add streaming support to chat model base
chore(core): update tenacity dependency range
Example 2: First release of a new package
Initial release
feat(deepseek): add initial DeepSeek chat model integration
feat(deepseek): add embeddings support
docs(deepseek): add README and usage examples
Example 3: Running the git log command locally
PKG_NAME="langchain-core"
PREV_TAG="langchain-core==1.2.10"
WORKING_DIR="libs/core"
git log --format="%s" "$PREV_TAG"..HEAD -- $WORKING_DIR