@@ -21,9 +21,9 @@ pr_author=$(echo "$pr_info" | jq -r '.author.login')
2121head_repo=$( echo " $pr_info " | jq -r ' .headRepository.nameWithOwner' )
2222is_fork=$( echo " $pr_info " | jq -r ' .isCrossRepository' )
2323
24- # We'll use AztecBot as the committer
25- author_name= " AztecBot "
26- author_email=" 49558828+AztecBot @users.noreply.github.com"
24+ # Get the PR author's name and email
25+ user_id= $( gh api " /users/ $pr_author " --jq ' .id ' )
26+ author_email=" ${user_id} + ${pr_author} @users.noreply.github.com"
2727
2828# Create a temporary worktree to do the squashing
2929worktree_dir=$( mktemp -d)
@@ -36,7 +36,7 @@ git worktree add "$worktree_dir" HEAD
3636cd " $worktree_dir "
3737
3838# Configure git with author's identity in worktree
39- git config user.name " $author_name "
39+ git config user.name " $pr_author "
4040git config user.email " $author_email "
4141
4242# Save our current branch commits
@@ -58,11 +58,11 @@ merge_base=$(git merge-base "$original_head" "origin/$base_branch")
5858# Get all commits between merge_base and HEAD, excluding merges
5959authors_info=$( git log " $merge_base ..$original_head " --no-merges --format=' %an <%ae>' | sort -u)
6060
61- # Build Co-authored-by trailers
61+ # Build Co-authored-by trailers, excluding the main PR author
6262co_authors=" "
6363while IFS= read -r author_line; do
64- # Skip empty lines and AztecBot itself
65- if [[
-n " $author_line " ]]
&& [[
" $author_line " != * " AztecBot" * ]]
&& [[
" $author_line " != * " [email protected] " * ]]
; then 64+ # Skip empty lines, the main PR author, AztecBot, and [email protected] 65+ if [[
-n " $author_line " ]]
&& [[
" $author_line " != * " $pr_author " * ]] && [[ " $author_line " != * " $author_email " * ]] && [[ " $author_line " != * " AztecBot" * ]]
&& [[
" $author_line " != * " [email protected] " * ]]
; then 6666 co_authors=" ${co_authors} Co-authored-by: ${author_line}
6767"
6868 fi
0 commit comments