Skip to content

Commit a165ee7

Browse files
graycreateclaude
andcommitted
feat: add contributor mentions in release notes
- Include GitHub usernames (@username) for each change - Add contributors section showing all contributors in the release - Apply to both English and Chinese release notes for Google Play - Maintain author attribution throughout the pipeline 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent a96ee38 commit a165ee7

File tree

1 file changed

+101
-12
lines changed

1 file changed

+101
-12
lines changed

.github/workflows/release.yml

Lines changed: 101 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,9 @@ jobs:
599599
echo "Deploying to track: $TRACK with status: $STATUS"
600600
601601
- name: Create whatsnew directory
602+
env:
603+
GH_TOKEN: ${{ github.token }}
604+
GITHUB_REPOSITORY: ${{ github.repository }}
602605
run: |
603606
mkdir -p whatsnew
604607
@@ -637,11 +640,39 @@ jobs:
637640
echo "$category:$cleaned_msg"
638641
}
639642
643+
# Function to get GitHub username from commit (reuse from above)
644+
get_github_username() {
645+
local commit_sha="$1"
646+
local username=$(gh api "repos/${{ github.repository }}/commits/${commit_sha}" --jq '.author.login // empty' 2>/dev/null || echo "")
647+
if [ -n "$username" ]; then
648+
echo "@$username"
649+
else
650+
local committer=$(gh api "repos/${{ github.repository }}/commits/${commit_sha}" --jq '.committer.login // empty' 2>/dev/null || echo "")
651+
if [ -n "$committer" ]; then
652+
echo "@$committer"
653+
else
654+
local git_author=$(git show -s --format='%an' $commit_sha)
655+
case "$git_author" in
656+
"Gray Zhang" | "gray" | "Gray")
657+
echo "@graycreate"
658+
;;
659+
"github-actions[bot]")
660+
echo "@github-actions[bot]"
661+
;;
662+
*)
663+
echo ""
664+
;;
665+
esac
666+
fi
667+
fi
668+
}
669+
640670
# Collect and categorize commits
641671
declare -A features
642672
declare -A bugs
643673
declare -A improvements
644674
declare -A performance
675+
declare -A contributors
645676
646677
if [ -n "$LAST_TAG" ]; then
647678
RANGE="$LAST_TAG..HEAD"
@@ -663,18 +694,24 @@ jobs:
663694
category=$(echo "$categorized" | cut -d':' -f1)
664695
clean_msg=$(echo "$categorized" | cut -d':' -f2-)
665696
697+
# Get author for this commit
698+
author=$(get_github_username "$sha")
699+
if [ -n "$author" ]; then
700+
contributors["$author"]="1"
701+
fi
702+
666703
case "$category" in
667704
feature)
668-
features["$clean_msg"]="1"
705+
features["$clean_msg"]="$author"
669706
;;
670707
bug)
671-
bugs["$clean_msg"]="1"
708+
bugs["$clean_msg"]="$author"
672709
;;
673710
improvement)
674-
improvements["$clean_msg"]="1"
711+
improvements["$clean_msg"]="$author"
675712
;;
676713
performance)
677-
performance["$clean_msg"]="1"
714+
performance["$clean_msg"]="$author"
678715
;;
679716
esac
680717
done < <(git log --oneline --no-merges $RANGE)
@@ -686,35 +723,61 @@ jobs:
686723
if [ ${#features[@]} -gt 0 ]; then
687724
echo "🚀 New Features:" >> whatsnew/whatsnew-en-US
688725
for msg in "${!features[@]}"; do
689-
echo "• $msg" >> whatsnew/whatsnew-en-US
726+
author="${features[$msg]}"
727+
if [ -n "$author" ]; then
728+
echo "• $msg (by $author)" >> whatsnew/whatsnew-en-US
729+
else
730+
echo "• $msg" >> whatsnew/whatsnew-en-US
731+
fi
690732
done
691733
echo "" >> whatsnew/whatsnew-en-US
692734
fi
693735
694736
if [ ${#bugs[@]} -gt 0 ]; then
695737
echo "🐛 Bug Fixes:" >> whatsnew/whatsnew-en-US
696738
for msg in "${!bugs[@]}"; do
697-
echo "• $msg" >> whatsnew/whatsnew-en-US
739+
author="${bugs[$msg]}"
740+
if [ -n "$author" ]; then
741+
echo "• $msg (by $author)" >> whatsnew/whatsnew-en-US
742+
else
743+
echo "• $msg" >> whatsnew/whatsnew-en-US
744+
fi
698745
done
699746
echo "" >> whatsnew/whatsnew-en-US
700747
fi
701748
702749
if [ ${#improvements[@]} -gt 0 ]; then
703750
echo "💪 Improvements:" >> whatsnew/whatsnew-en-US
704751
for msg in "${!improvements[@]}"; do
705-
echo "• $msg" >> whatsnew/whatsnew-en-US
752+
author="${improvements[$msg]}"
753+
if [ -n "$author" ]; then
754+
echo "• $msg (by $author)" >> whatsnew/whatsnew-en-US
755+
else
756+
echo "• $msg" >> whatsnew/whatsnew-en-US
757+
fi
706758
done
707759
echo "" >> whatsnew/whatsnew-en-US
708760
fi
709761
710762
if [ ${#performance[@]} -gt 0 ]; then
711763
echo "⚡ Performance:" >> whatsnew/whatsnew-en-US
712764
for msg in "${!performance[@]}"; do
713-
echo "• $msg" >> whatsnew/whatsnew-en-US
765+
author="${performance[$msg]}"
766+
if [ -n "$author" ]; then
767+
echo "• $msg (by $author)" >> whatsnew/whatsnew-en-US
768+
else
769+
echo "• $msg" >> whatsnew/whatsnew-en-US
770+
fi
714771
done
715772
echo "" >> whatsnew/whatsnew-en-US
716773
fi
717774
775+
# Add contributors section if there are any
776+
if [ ${#contributors[@]} -gt 0 ]; then
777+
echo "👥 Contributors: ${!contributors[@]}" >> whatsnew/whatsnew-en-US
778+
echo "" >> whatsnew/whatsnew-en-US
779+
fi
780+
718781
echo "Thank you for using V2er! Please report any issues on GitHub." >> whatsnew/whatsnew-en-US
719782
720783
# Generate Chinese release notes
@@ -724,35 +787,61 @@ jobs:
724787
if [ ${#features[@]} -gt 0 ]; then
725788
echo "🚀 新功能:" >> whatsnew/whatsnew-zh-CN
726789
for msg in "${!features[@]}"; do
727-
echo "• $msg" >> whatsnew/whatsnew-zh-CN
790+
author="${features[$msg]}"
791+
if [ -n "$author" ]; then
792+
echo "• $msg (贡献者 $author)" >> whatsnew/whatsnew-zh-CN
793+
else
794+
echo "• $msg" >> whatsnew/whatsnew-zh-CN
795+
fi
728796
done
729797
echo "" >> whatsnew/whatsnew-zh-CN
730798
fi
731799
732800
if [ ${#bugs[@]} -gt 0 ]; then
733801
echo "🐛 问题修复:" >> whatsnew/whatsnew-zh-CN
734802
for msg in "${!bugs[@]}"; do
735-
echo "• $msg" >> whatsnew/whatsnew-zh-CN
803+
author="${bugs[$msg]}"
804+
if [ -n "$author" ]; then
805+
echo "• $msg (贡献者 $author)" >> whatsnew/whatsnew-zh-CN
806+
else
807+
echo "• $msg" >> whatsnew/whatsnew-zh-CN
808+
fi
736809
done
737810
echo "" >> whatsnew/whatsnew-zh-CN
738811
fi
739812
740813
if [ ${#improvements[@]} -gt 0 ]; then
741814
echo "💪 改进优化:" >> whatsnew/whatsnew-zh-CN
742815
for msg in "${!improvements[@]}"; do
743-
echo "• $msg" >> whatsnew/whatsnew-zh-CN
816+
author="${improvements[$msg]}"
817+
if [ -n "$author" ]; then
818+
echo "• $msg (贡献者 $author)" >> whatsnew/whatsnew-zh-CN
819+
else
820+
echo "• $msg" >> whatsnew/whatsnew-zh-CN
821+
fi
744822
done
745823
echo "" >> whatsnew/whatsnew-zh-CN
746824
fi
747825
748826
if [ ${#performance[@]} -gt 0 ]; then
749827
echo "⚡ 性能优化:" >> whatsnew/whatsnew-zh-CN
750828
for msg in "${!performance[@]}"; do
751-
echo "• $msg" >> whatsnew/whatsnew-zh-CN
829+
author="${performance[$msg]}"
830+
if [ -n "$author" ]; then
831+
echo "• $msg (贡献者 $author)" >> whatsnew/whatsnew-zh-CN
832+
else
833+
echo "• $msg" >> whatsnew/whatsnew-zh-CN
834+
fi
752835
done
753836
echo "" >> whatsnew/whatsnew-zh-CN
754837
fi
755838
839+
# Add contributors section if there are any
840+
if [ ${#contributors[@]} -gt 0 ]; then
841+
echo "👥 贡献者:${!contributors[@]}" >> whatsnew/whatsnew-zh-CN
842+
echo "" >> whatsnew/whatsnew-zh-CN
843+
fi
844+
756845
echo "感谢您使用 V2er!如遇问题请在 GitHub 上反馈。" >> whatsnew/whatsnew-zh-CN
757846
758847
- name: Upload to Play Store (with debug symbols)

0 commit comments

Comments
 (0)