Skip to content

Commit

Permalink
build: fix extraction in resolve_user
Browse files Browse the repository at this point in the history
  • Loading branch information
Planeshifter committed Sep 29, 2024
1 parent b6b1c10 commit 4a52a31
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/scripts/generate_pr_commit_message
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ on_error() {
exit "$1"
}

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

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

0 comments on commit 4a52a31

Please sign in to comment.