@@ -19,20 +19,34 @@ jobs:
1919
2020 - name : Generate Changelog
2121 id : changelog
22+ env :
23+ GH_TOKEN : ${{ github.token }}
2224 run : |
2325 # Get the previous tag
2426 PREVIOUS_TAG=$(git tag --sort=-version:refname | grep -v "^${{ github.ref_name }}$" | head -n 1)
25-
27+
2628 if [ -z "$PREVIOUS_TAG" ]; then
2729 echo "No previous tag found, showing all commits"
2830 PREVIOUS_TAG=$(git rev-list --max-parents=0 HEAD)
2931 fi
30-
32+
3133 echo "Generating changelog from $PREVIOUS_TAG to ${{ github.ref_name }}"
32-
33- # Generate changelog with commit title, author, and link
34- CHANGELOG=$(git log $PREVIOUS_TAG..${{ github.ref_name }} --pretty=format:"- %s by %an ([%h](https://github.com/${{ github.repository }}/commit/%H))" --no-merges)
35-
34+
35+ # Generate changelog with commit title, author name, username, and link
36+ CHANGELOG=""
37+ while IFS='|' read -r hash title author email; do
38+ # Try to get GitHub username from commit
39+ username=$(gh api "repos/${{ github.repository }}/commits/$hash" --jq '.author.login' 2>/dev/null || echo "")
40+
41+ if [ -n "$username" ]; then
42+ author_info="$author (@$username)"
43+ else
44+ author_info="$author"
45+ fi
46+
47+ CHANGELOG="${CHANGELOG}- $title by $author_info ([$hash](https://github.com/${{ github.repository }}/commit/$hash))"$'\n'
48+ done < <(git log $PREVIOUS_TAG..${{ github.ref_name }} --pretty=format:"%H|%s|%an|%ae" --no-merges)
49+
3650 # Save to file and environment variable
3751 echo "$CHANGELOG" > changelog.md
3852 echo "changelog<<EOF" >> $GITHUB_OUTPUT
0 commit comments