Skip to content

Commit ba0e870

Browse files
committed
fix: use GitHub username instead of git author name in release changelog
- Replace %an (git author name) with actual GitHub username via API - Falls back to git author name if API call fails - Ensures @graycreate appears instead of @gray in release notes
1 parent 503bf06 commit ba0e870

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

.github/workflows/release.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,33 @@ jobs:
352352
353353
# Get commits since last tag
354354
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
355+
356+
# Function to get GitHub username from commit
357+
get_github_username() {
358+
local commit_sha="$1"
359+
# Try to get the GitHub username from the commit using gh api
360+
local username=$(gh api "repos/${{ github.repository }}/commits/${commit_sha}" --jq '.author.login // .commit.author.name' 2>/dev/null || echo "")
361+
if [ -n "$username" ]; then
362+
echo "@$username"
363+
else
364+
# Fallback to git author name if API fails
365+
echo "$(git show -s --format='%an' $commit_sha)"
366+
fi
367+
}
368+
369+
# Generate changelog with GitHub usernames
355370
if [ -n "$LAST_TAG" ]; then
356-
git log --pretty=format:"* %s by @%an" "$LAST_TAG"..HEAD >> CHANGELOG.md
371+
while IFS= read -r commit_sha; do
372+
commit_msg=$(git show -s --format='%s' $commit_sha)
373+
author=$(get_github_username $commit_sha)
374+
echo "* $commit_msg by $author" >> CHANGELOG.md
375+
done < <(git rev-list "$LAST_TAG"..HEAD)
357376
else
358-
git log --pretty=format:"* %s by @%an" -10 >> CHANGELOG.md
377+
while IFS= read -r commit_sha; do
378+
commit_msg=$(git show -s --format='%s' $commit_sha)
379+
author=$(get_github_username $commit_sha)
380+
echo "* $commit_msg by $author" >> CHANGELOG.md
381+
done < <(git rev-list HEAD -10)
359382
fi
360383
361384
echo "" >> CHANGELOG.md

0 commit comments

Comments
 (0)