Skip to content

Commit 6093f5f

Browse files
committed
fix: release notes workflow inserting into front matter
The awk script matched the 1st '---' in releases.md, which is the YAML front matter opener, not the content separator. This wedged new entries inside the front matter, breaking the page. v0.8.1 was the first automated run to hit this. Fix the awk to count '---' occurrences and insert after the 3rd (front matter open, front matter close, content separator). Also add a fallback for empty release bodies: if goreleaser produces no changelog, generate a commit list from git log between the previous and current tag. This caused v0.8.1 to have an empty entry. Fix releases.md itself by moving the v0.8.1 entry out of the front matter and populating it with its actual commit.
1 parent bb5e647 commit 6093f5f

File tree

2 files changed

+39
-14
lines changed

2 files changed

+39
-14
lines changed

.github/workflows/release-notes.yml

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,29 +57,55 @@ jobs:
5757
sed 's/^\*\*Full Changelog\*\*.*$//' | \
5858
sed '/^$/N;/^\n$/d' > /tmp/release_body.txt
5959
60+
- name: Generate fallback body if empty
61+
run: |
62+
# If the release body is empty (only whitespace), generate
63+
# a commit list from git log between the previous and current tag.
64+
if ! grep -qP '\S' /tmp/release_body.txt; then
65+
TAG="${{ steps.release.outputs.tag }}"
66+
REPO_URL="https://github.com/${{ github.repository }}"
67+
68+
# Find the tag immediately before this one
69+
PREV_TAG=$(git tag --sort=-v:refname | grep -A1 "^${TAG}$" | tail -1)
70+
71+
if [ -n "$PREV_TAG" ] && [ "$PREV_TAG" != "$TAG" ]; then
72+
git log --oneline --no-merges "${PREV_TAG}..${TAG}" | \
73+
sed -E "s/^([a-f0-9]+) (.+)/- \2 ([\1](${REPO_URL}\/commit\/\1))/" \
74+
> /tmp/release_body.txt
75+
fi
76+
fi
77+
6078
- name: Update releases.md
6179
run: |
6280
TAG="${{ steps.release.outputs.tag }}"
6381
DATE="${{ steps.release.outputs.date }}"
6482
RELEASE_URL="https://github.com/${{ github.repository }}/releases/tag/${TAG}"
6583
6684
# Create the new release section
67-
cat > /tmp/new_release.md << EOF
85+
cat > /tmp/new_release.md <<EOF
6886
## [${TAG}](${RELEASE_URL}) - ${DATE}
6987
7088
$(cat /tmp/release_body.txt)
7189
7290
---
73-
7491
EOF
7592
76-
# Insert after the intro section (after first "---" on its own line)
93+
# Insert after the 3rd "---" line. The file structure is:
94+
# --- (1st: front matter open)
95+
# title: ...
96+
# --- (2nd: front matter close)
97+
# # Release Notes
98+
# ...intro text...
99+
# --- (3rd: content separator)
100+
# ## [vX.Y.Z]... (first release entry)
77101
awk '
78-
/^---$/ && !found {
102+
/^---$/ {
103+
count++
79104
print
80-
found = 1
81-
print ""
82-
while ((getline line < "/tmp/new_release.md") > 0) print line
105+
if (count == 3) {
106+
print ""
107+
while ((getline line < "/tmp/new_release.md") > 0) print line
108+
}
83109
next
84110
}
85111
{ print }

docs-web/docs/releases.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
---
2-
3-
## [v0.8.1](https://github.com/amterp/rad/releases/tag/v0.8.1) - 2026-03-08
4-
5-
6-
7-
---
8-
92
title: Release Notes
103
---
114

@@ -15,6 +8,12 @@ All Rad releases. Newest first.
158

169
---
1710

11+
## [v0.8.1](https://github.com/amterp/rad/releases/tag/v0.8.1) - 2026-03-08
12+
13+
- fix: use pure Go DNS resolver for Linux static builds ([622026ca](https://github.com/amterp/rad/commit/622026ca))
14+
15+
---
16+
1817
## [v0.8.0](https://github.com/amterp/rad/releases/tag/v0.8.0) - 2026-01-29
1918

2019
- feat!: remove get_default function in favor of ?? operator ([7bbad61](https://github.com/amterp/rad/commit/7bbad61))

0 commit comments

Comments
 (0)