#!/bin/sh
set -e

# Configure git identity for commits
git config --global user.name "${GIT_USER_NAME}"
git config --global user.email "${GIT_USER_EMAIL}"

# Configure HTTPS auth via GITHUB_TOKEN if provided
if [ -n "${GITHUB_TOKEN}" ]; then
    git config --global credential.helper store
    printf 'https://x-access-token:%s@github.com\n' "${GITHUB_TOKEN}" > ~/.git-credentials
fi
exec "$@"

