Files
GitHub.webhook-scripts/bin/new_clone.sh
Clemens Schwaighofer 8d2731d555 Basic script check in
This is not completed and under development
2025-06-27 19:06:35 +09:00

24 lines
522 B
Bash
Executable File

#!/usr/bin/env bash
REPOSITORY="$1";
BRANCH="$2";
REMOTE_HOST="$3";
REMOTE="$4";
if [ -n "${REMOTE}" ]; then
REMOTE="origin"
fi;
BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
# shellcheck source=init.sh
. "${BASE_FOLDER}init.sh";
if [ -z "${REMOTE_HOST}" ]; then
echo "Must set a remote host for the repository";
exit;
fi;
echo "New clone";
echo ${GIT_COMMAND} clone -b "${BRANCH}" --single-branch --depth 1 --origin "${REMOTE}" "${REMOTE_HOST}:${REPOSITORY}" "${GIT_REPOSITORY_FOLDER}${CLONE_BASE}";
# __END__