Skip to content

Commit 4a52a31

Browse files
committed
build: fix extraction in resolve_user
1 parent b6b1c10 commit 4a52a31

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.github/workflows/scripts/generate_pr_commit_message

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ on_error() {
5656
exit "$1"
5757
}
5858

59-
# Resolves a name and email using .mailmap via git check-mailmap, falling back to the provided values if no match is found.
59+
# Resolves a name and email using .mailmap via `git check-mailmap`, falling back to the provided values if no match is found.
6060
#
6161
# $1 - name
6262
# $2 - email
@@ -85,8 +85,8 @@ resolve_user() {
8585
name_email=$(grep -i "$github_handle" "$mailmap_file" | head -n 1)
8686

8787
if [ -n "$name_email" ]; then
88-
# Extract name and email from the matching line:
89-
echo "$name_email" | sed -E 's/^(.*)<(.*)>.*$/\1 <\2>/' | xargs
88+
# Extract only the first name and email pair:
89+
echo "$name_email" | sed -E 's/^([^<]+)<([^>]+)>.*/\1<\2>/' | xargs
9090
else
9191
# If no match found, use the GitHub handle as is:
9292
echo "$github_handle <$github_handle@users.noreply.github.com>"

0 commit comments

Comments
 (0)