@@ -612,7 +612,80 @@ jobs:
612612 run : |
613613 mkdir -p whatsnew
614614
615- # Source the shared functions defined earlier
615+ # Define shared functions (duplicated from release job since jobs run in isolation)
616+ cat > /tmp/release_functions.sh << 'FUNCTIONS_EOF'
617+ # Function to categorize commit message
618+ categorize_commit() {
619+ local msg="$1"
620+ local category=""
621+ local cleaned_msg=""
622+
623+ if [[ "$msg" =~ ^fix(\(.*\))?:\ (.*)$ ]] || [[ "$msg" =~ ^fix\ (.*)$ ]]; then
624+ category="bug"
625+ cleaned_msg="${BASH_REMATCH[-1]}"
626+ elif [[ "$msg" =~ ^feat(\(.*\))?:\ (.*)$ ]] || [[ "$msg" =~ ^feat\ (.*)$ ]]; then
627+ category="feature"
628+ cleaned_msg="${BASH_REMATCH[-1]}"
629+ elif [[ "$msg" =~ ^perf(\(.*\))?:\ (.*)$ ]]; then
630+ category="performance"
631+ cleaned_msg="${BASH_REMATCH[2]}"
632+ elif [[ "$msg" =~ ^refactor(\(.*\))?:\ (.*)$ ]]; then
633+ category="improvement"
634+ cleaned_msg="${BASH_REMATCH[2]}"
635+ elif [[ "$msg" =~ ^chore(\(.*\))?:\ (.*)$ ]]; then
636+ category="maintenance"
637+ cleaned_msg="${BASH_REMATCH[2]}"
638+ elif [[ "$msg" =~ ^docs(\(.*\))?:\ (.*)$ ]]; then
639+ category="documentation"
640+ cleaned_msg="${BASH_REMATCH[2]}"
641+ else
642+ category="other"
643+ cleaned_msg="$msg"
644+ fi
645+
646+ # Remove PR numbers from the end
647+ cleaned_msg=$(echo "$cleaned_msg" | sed 's/ (#[0-9]*)//')
648+
649+ # Capitalize first letter
650+ cleaned_msg="$(echo "${cleaned_msg:0:1}" | tr '[:lower:]' '[:upper:]')${cleaned_msg:1}"
651+
652+ echo "$category:$cleaned_msg"
653+ }
654+
655+ # Function to get GitHub username from commit
656+ get_github_username() {
657+ local commit_sha="$1"
658+ local github_repo="${GITHUB_REPOSITORY}"
659+ # Try to get the GitHub username from the commit using gh api
660+ local username=$(gh api "repos/${github_repo}/commits/${commit_sha}" --jq '.author.login // empty' 2>/dev/null || echo "")
661+ if [ -n "$username" ]; then
662+ echo "@$username"
663+ else
664+ # Fallback: try to get committer login if author login is not available
665+ local committer=$(gh api "repos/${github_repo}/commits/${commit_sha}" --jq '.committer.login // empty' 2>/dev/null || echo "")
666+ if [ -n "$committer" ]; then
667+ echo "@$committer"
668+ else
669+ # Last resort: use hardcoded mapping for known authors
670+ local git_author=$(git show -s --format='%an' $commit_sha)
671+ case "$git_author" in
672+ "Gray Zhang" | "gray" | "Gray")
673+ echo "@graycreate"
674+ ;;
675+ "github-actions[bot]")
676+ echo "@github-actions[bot]"
677+ ;;
678+ *)
679+ # If no mapping found, use git author name without @
680+ echo "$git_author"
681+ ;;
682+ esac
683+ fi
684+ fi
685+ }
686+ FUNCTIONS_EOF
687+
688+ # Source the shared functions
616689 source /tmp/release_functions.sh
617690
618691 # Get commits since last tag for categorization
0 commit comments