Skip to content

Instantly share code, notes, and snippets.

@finagin
Created February 23, 2024 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save finagin/21073cfb79151e124c23476668228c58 to your computer and use it in GitHub Desktop.
Save finagin/21073cfb79151e124c23476668228c58 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Initialize the wiki
if [ ! -d .git ] && [ "$(git rev-parse --is-bare-repository 2> /dev/null)" != "true" ]; then
# Check if the parent repository has a wiki
REPO=$(git --git-dir=/.git config --get remote.origin.url | sed -e 's/.git$/.wiki.git/g' -e 's/:/\//g' -e "s/git@/https:\/\/$GIT_AUTH@/g" -e "s/:\/\/@/:\/\//g")
[ ! -z $REPO ] \
&& git clone --no-tags --single-branch --depth 1 $REPO . 2> /dev/null \
|| git init 2> /dev/null
fi
# Set git user.name and user.email
if [ ${GOLLUM_AUTHOR_USERNAME:+1} ]; then
git config user.name "${GOLLUM_AUTHOR_USERNAME}"
fi
if [ ${GOLLUM_AUTHOR_EMAIL:+1} ]; then
git config user.email "${GOLLUM_AUTHOR_EMAIL}"
fi
# Start gollum service
exec gollum $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment