Skip to content

Commit 6b20ae0

Browse files
bones7456claude
andcommitted
Surface direct commits in release notes when no PR landed in the range
GitHub's generate-notes API only sees merged PRs. Releases cut from direct pushes to main (which is how this repo currently ships) get a near-empty "Full Changelog" body. Add .github/release.yml to categorize PR-based notes when they exist, and have the workflow fall back to a git log between the previous and current tag when generate-notes returns no "What's Changed" section. Switch checkout to full depth so git describe can reach the previous tag. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 352ba14 commit 6b20ae0

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

.github/release.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
changelog:
2+
categories:
3+
- title: Features
4+
labels:
5+
- enhancement
6+
- feature
7+
- title: Bug Fixes
8+
labels:
9+
- bug
10+
- fix
11+
- title: Documentation
12+
labels:
13+
- documentation
14+
- docs
15+
- title: Other Changes
16+
labels:
17+
- "*"

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
uses: actions/checkout@v5
2929
with:
3030
ref: ${{ github.event.inputs.tag || github.ref }}
31+
fetch-depth: 0
32+
fetch-tags: true
3133

3234
- name: Select Xcode
3335
uses: maxim-lobanov/setup-xcode@v1
@@ -76,10 +78,40 @@ jobs:
7678
NOTES_MD="$RUNNER_TEMP/release_notes.md"
7779
NOTES_HTML="$RUNNER_TEMP/release_notes.html"
7880
81+
# PR-based notes (uses .github/release.yml for categorization).
7982
gh api -X POST "/repos/${{ github.repository }}/releases/generate-notes" \
8083
-f tag_name="$TAG" \
8184
--jq .body > "$NOTES_MD"
8285
86+
# If no PRs landed between the previous tag and this one, the body
87+
# only carries the "Full Changelog" link. Synthesize a Changes
88+
# section from git log so direct commits still appear in the notes.
89+
if ! grep -qF '## What' "$NOTES_MD"; then
90+
# Fetch full history so describe/log can reach the previous tag.
91+
git fetch --tags --unshallow 2>/dev/null || git fetch --tags
92+
PREV_TAG="$(git describe --tags --abbrev=0 "$TAG^" 2>/dev/null || true)"
93+
RANGE="${PREV_TAG:+$PREV_TAG..}$TAG"
94+
95+
COMMITS="$(git log --no-merges \
96+
--pretty=format:"- %s ([\`%h\`](https://github.com/${{ github.repository }}/commit/%H))" \
97+
"$RANGE")"
98+
99+
if [ -n "$COMMITS" ]; then
100+
{
101+
echo "## Changes"
102+
echo
103+
echo "$COMMITS"
104+
echo
105+
cat "$NOTES_MD"
106+
} > "$NOTES_MD.new"
107+
mv "$NOTES_MD.new" "$NOTES_MD"
108+
fi
109+
fi
110+
111+
echo "--- release notes (markdown) ---"
112+
cat "$NOTES_MD"
113+
echo "--- end ---"
114+
83115
gh api -X POST /markdown \
84116
-F text=@"$NOTES_MD" \
85117
-f mode=gfm \

0 commit comments

Comments
 (0)