Skip to content

Commit

Permalink
add empty check for avatar url
Browse files Browse the repository at this point in the history
  • Loading branch information
NBprojekt authored Sep 12, 2022
1 parent d81d875 commit 739a34d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ if [ "${INPUT_AVATARS_AUTO_FETCH}" == "true" ]; then
# Use github api to get avatar url using the author name or email
avatar_by_name=$(wget -O - -o /dev/null https://api.github.com/users/$name | jq -r '.avatar_url')

if [ "$avatar_by_name" != "null" ]; then
if ([ "$avatar_by_name" != "null" ] && [ ! -z "$avatar_by_name" ]); then
printf "\n> \t\tDownloading avatar for $name from: $avatar_by_name"
wget -O "/gource/avatars/$name.png" $avatar_by_name >/dev/null 2>&1
((avatarsCount=avatarsCount+1))
continue
fi

avatar_by_email=$(wget -O - -o /dev/null https://api.github.com/search/users?q=$email | jq -r '.items[0].avatar_url')
if [ "$avatar_by_email" != "null" ]; then
if ([ "$avatar_by_email" != "null" ] && [ ! -z "$avatar_by_name" ]); then
printf "\n> \t\tDownloading avatar for $email from: $avatar_by_email"
wget -O "/gource/avatars/$name.png" $avatar_by_email >/dev/null 2>&1
((avatarsCount=avatarsCount+1))
Expand Down

0 comments on commit 739a34d

Please sign in to comment.