Git github set user avatar with base64 favicon

94 Views Asked by At

I need to set up a user's avatar on github which is a bot that is activated via action with a base64 favicon.

This base64 favicon is taken from the reference site, I did a test with Google.

The favicon is taken correctly but is not set as the user's avatar.

In the end I tried to remove both the file containing the bas64 of the image and the favicon, I also tried not to remove them thinking that it could be the problem, but it still doesn't work.

Is the only possible solution to use gravatar?

Can you give me a hand?

curl -s www.google.com/favicon.ico > favicon.ico
base64 favicon.ico > favicon_base64.txt
AVATAR_BASE64=$(cat favicon_base64.txt)

# Initialize git
remote_repo="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git config http.sslVerify "${SSL_VERIFY}"
git config user.avatar "data:image/png;base64,${AVATAR_BASE64}"
git config user.name "${NAME}"
git config user.email "${EMAIL}"
git remote add publisher "${remote_repo}"
git show-ref # Useful for debugging
git branch --verbose

$(rm favicon_base64.txt favicon.ico)

or

curl -s "www.google.com/favicon.ico" --output favicon.ico

if [ $? -ne 0 ]; then
    echo "Error: Failed to download the favicon."
    exit 1
fi

AVATAR_BASE64=$(base64 favicon.ico)

# Initialize git
remote_repo="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git config http.sslVerify "${SSL_VERIFY}"
git config user.avatar "data:image/png;base64,${AVATAR_BASE64}"
git config user.name "${NAME}"
git config user.email "${EMAIL}"
git remote add publisher "${remote_repo}"
git show-ref # Useful for debugging
git branch --verbose

$(rm favicon.ico)
1

There are 1 best solutions below

0
grg On

user.avatar is not a Git config option. Classic LLM hallucination.

There is no API for setting a GitHub profile picture. You can find a discussion on this at https://github.com/orgs/community/discussions/65206.