Skip to content

Commit

Permalink
Update scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
gavv committed Nov 17, 2023
1 parent 11f1fe8 commit 99ae0f5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/update_authors.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/usr/bin/env bash

set -euo pipefail

function find_login() {
local github_login=""

if echo "$1" | grep -q users.noreply.github.com
then
github_login="$(echo "$1" | sed -re 's,^([0-9]+\+)?(.*)@users.noreply.github.com,\2,')"
else
github_login="$(gh api "/search/users?q=$1" --jq '.items[0].login')"
github_login="$(gh api "/search/users?q=$(echo -n "$1" | jq -sRr @uri)" \
--jq '.items[0].login')"
fi

if [[ "${github_login}" != "" ]] && [[ "${github_login}" != "null" ]]
Expand Down Expand Up @@ -71,7 +74,7 @@ function update_author() {
fi

local contact_name="$(find_name "${github_login}")"
if [ -z "${contact_name}" ]
if [ -z "${contact_name}" ] || [[ "${contact_name}" != *" "* && "${commit_name}" = *" "* ]]
then
contact_name="${commit_name}"
fi
Expand Down

0 comments on commit 99ae0f5

Please sign in to comment.