Skip to content

Commit fcb6965

Browse files
committed
docs: fix release action to include all commit info
1 parent a49322b commit fcb6965

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

.github/scripts/finalize-release-notes.sh

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#
55
# Stamps the "## Unreleased" section in a release-notes file with a version
66
# and date, and extracts the section content for use in GitHub releases / email.
7+
# Also includes all commits since the last release for complete transparency.
78
#
89
# Usage: finalize-release-notes.sh <version> <file-path>
910
#
@@ -86,11 +87,44 @@ NEW_HEADER="## Version ${VERSION} - ${DATE_STAMP}"
8687

8788
mv "${FILE}.tmp" "$FILE"
8889

90+
# Get commits since the last release
91+
LAST_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
92+
COMMIT_LIST=""
93+
94+
if [[ -n "$LAST_TAG" ]]; then
95+
echo "Fetching commits since ${LAST_TAG}..."
96+
# Get commits between last tag and HEAD, excluding merge commits and skip ci commits
97+
COMMIT_LIST=$(git log "${LAST_TAG}..HEAD" \
98+
--no-merges \
99+
--pretty=format:"- %s ([%h](https://github.com/${GITHUB_REPOSITORY}/commit/%H))" \
100+
--grep="\[skip ci\]" --invert-grep \
101+
|| echo "")
102+
else
103+
echo "No previous tag found, fetching all commits..."
104+
COMMIT_LIST=$(git log \
105+
--no-merges \
106+
--pretty=format:"- %s ([%h](https://github.com/${GITHUB_REPOSITORY}/commit/%H))" \
107+
--grep="\[skip ci\]" --invert-grep \
108+
|| echo "")
109+
fi
110+
89111
# Write the extracted section content (for GitHub release body / future email)
90112
{
91113
echo "$NEW_HEADER"
92114
echo ""
93-
echo "$TRIMMED"
115+
if [[ -n "$TRIMMED" ]]; then
116+
echo "$TRIMMED"
117+
echo ""
118+
fi
119+
120+
# Add commit history if available
121+
if [[ -n "$COMMIT_LIST" ]]; then
122+
echo "---"
123+
echo ""
124+
echo "### 📝 All Changes"
125+
echo ""
126+
echo "$COMMIT_LIST"
127+
fi
94128
} > "${FILE}.section"
95129

96130
echo "Finalized release notes for v${VERSION}"

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ jobs:
3939
- name: Finalize release notes
4040
if: steps.semver.outputs.new_release_published == 'true'
4141
id: finalize-notes
42+
env:
43+
GITHUB_REPOSITORY: ${{ github.repository }}
4244
run: |
4345
git pull origin master
4446
chmod +x .github/scripts/finalize-release-notes.sh

0 commit comments

Comments
 (0)