Skip to content

Commit c9966c0

Browse files
committed
ci: Improve release notes in release.yaml
1 parent 51d9858 commit c9966c0

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

.github/workflows/release.yml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
description: 'Version tag (e.g., v0.1.1)'
88
required: true
99
type: string
10+
description:
11+
description: 'Release description (optional - provide context about this release)'
12+
required: false
13+
type: string
1014

1115
env:
1216
GO_VERSION: '1.25'
@@ -105,47 +109,43 @@ jobs:
105109
- name: Generate release notes
106110
id: release_notes
107111
run: |
112+
# Get repository name from GitHub context
113+
REPO_NAME="${{ github.event.repository.name }}"
114+
REPO_URL="https://github.com/${{ github.repository }}"
115+
108116
# Get the previous tag
109117
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
110118
111-
if [ -z "$PREV_TAG" ]; then
112-
# First release
113-
echo "notes<<EOF" >> $GITHUB_OUTPUT
114-
echo "## DotErr ${{ inputs.version }}" >> $GITHUB_OUTPUT
119+
echo "notes<<EOF" >> $GITHUB_OUTPUT
120+
echo "## ${REPO_NAME} ${{ inputs.version }}" >> $GITHUB_OUTPUT
121+
echo "" >> $GITHUB_OUTPUT
122+
123+
# Add user-provided description if present
124+
if [ -n "${{ inputs.description }}" ]; then
125+
echo "${{ inputs.description }}" >> $GITHUB_OUTPUT
115126
echo "" >> $GITHUB_OUTPUT
116-
echo "Initial release of go-doterr - embeddable, zero-dependency error composition for Go." >> $GITHUB_OUTPUT
127+
fi
128+
129+
if [ -z "$PREV_TAG" ]; then
130+
# First release - show all commits from beginning
131+
echo "### Commits" >> $GITHUB_OUTPUT
117132
echo "" >> $GITHUB_OUTPUT
118-
echo "### Features" >> $GITHUB_OUTPUT
119-
echo "- Structured error metadata with key-value pairs" >> $GITHUB_OUTPUT
120-
echo "- Sentinel error support for type-safe error identification" >> $GITHUB_OUTPUT
121-
echo "- Layered error composition with cause chains" >> $GITHUB_OUTPUT
122-
echo "- Error enrichment with \`WithErr()\` for same-function metadata" >> $GITHUB_OUTPUT
123-
echo "- Multi-error bundling with \`CombineErrs()\`" >> $GITHUB_OUTPUT
124-
echo "- Zero external dependencies - pure Go stdlib" >> $GITHUB_OUTPUT
125-
echo "- Three usage patterns: embed source file, dot-import, or normal import" >> $GITHUB_OUTPUT
126-
echo "- Cross-package error detection for embedded instances" >> $GITHUB_OUTPUT
133+
git log --pretty=format:"- [**%h**](${REPO_URL}/commit/%H) - %s (%an, %ar)" >> $GITHUB_OUTPUT
127134
echo "" >> $GITHUB_OUTPUT
128-
echo "### Usage Patterns" >> $GITHUB_OUTPUT
129-
echo "1. **Embed the source file** (recommended) - copy \`doterr.go\` directly into your package" >> $GITHUB_OUTPUT
130-
echo "2. **Dot-import** - \`import . \"github.com/mikeschinkel/go-doterr\"\`" >> $GITHUB_OUTPUT
131-
echo "3. **Normal import** - \`import \"github.com/mikeschinkel/go-doterr\"\`" >> $GITHUB_OUTPUT
132135
echo "" >> $GITHUB_OUTPUT
133-
echo "See [README.md](README.md) for full documentation and examples." >> $GITHUB_OUTPUT
134-
echo "EOF" >> $GITHUB_OUTPUT
136+
echo "See [README.md](README.md) for documentation and usage." >> $GITHUB_OUTPUT
135137
else
136-
# Subsequent releases - generate from commits
137-
echo "notes<<EOF" >> $GITHUB_OUTPUT
138-
echo "## DotErr ${{ inputs.version }}" >> $GITHUB_OUTPUT
139-
echo "" >> $GITHUB_OUTPUT
138+
# Subsequent releases - show commits since last tag
140139
echo "### Changes since $PREV_TAG" >> $GITHUB_OUTPUT
141140
echo "" >> $GITHUB_OUTPUT
142-
git log ${PREV_TAG}..HEAD --pretty=format:"- %s" >> $GITHUB_OUTPUT
141+
git log ${PREV_TAG}..HEAD --pretty=format:"- [**%h**](${REPO_URL}/commit/%H) - %s (%an, %ar)" >> $GITHUB_OUTPUT
143142
echo "" >> $GITHUB_OUTPUT
144143
echo "" >> $GITHUB_OUTPUT
145-
echo "**Full Changelog**: https://github.com/mikeschinkel/go-doterr/compare/${PREV_TAG}...${{ inputs.version }}" >> $GITHUB_OUTPUT
146-
echo "EOF" >> $GITHUB_OUTPUT
144+
echo "**Full Changelog**: ${REPO_URL}/compare/${PREV_TAG}...${{ inputs.version }}" >> $GITHUB_OUTPUT
147145
fi
148146
147+
echo "EOF" >> $GITHUB_OUTPUT
148+
149149
- name: Create GitHub Release
150150
uses: softprops/action-gh-release@v2
151151
with:

0 commit comments

Comments
 (0)