Skip to content

recursive submodule fix #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions script/updategitsubmodules.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
#!/bin/sh
set -e

if [ -z "$GITHUB_TOKEN" ]; then
echo "ERROR: \$GITHUB_TOKEN var is not set or empty"
exit
exit 1
fi

mkdir ~/.ssh
ssh-keyscan github.com > ~/.ssh/known_hosts
sed -i 's/git@/https:\/\//' .gitmodules || exit
sed -i 's/ssh:\/\///' .gitmodules
sed -i 's/github.com:/github.com\//' .gitmodules
sed -i "s/https:\/\/github.com/https:\/\/[email protected]/" .gitmodules
git config --global url.https://[email protected]/.insteadOf [email protected]:

if [ "$CF_SUBMODULE_SYNC" = "true" ]; then
echo "\$CF_SUBMODULE_SYNC var is set to 'true'. Syncing submodules"
echo "git submodule sync"
git submodule sync
echo "\$CF_SUBMODULE_SYNC var is set to 'true'. Syncing submodules"
echo "git submodule sync"
git submodule sync
fi

SUBMODULE_UPDATE_RECURSIVE_FLAG=""
if [ "$CF_SUBMODULE_UPDATE_RECURSIVE" = "true" ]; then
echo "\$CF_SUBMODULE_UPDATE_RECURSIVE var is set to 'true'. Submodules will be recursively updated"
SUBMODULE_UPDATE_RECURSIVE_FLAG=--recursive
echo "\$CF_SUBMODULE_UPDATE_RECURSIVE var is set to 'true'. Submodules will be recursively updated"
SUBMODULE_UPDATE_RECURSIVE_FLAG=--recursive
fi

echo "Updating git submodules"
echo "git submodule update --init $SUBMODULE_UPDATE_RECURSIVE_FLAG"
git submodule update --init $SUBMODULE_UPDATE_RECURSIVE_FLAG
echo "Git submodules were updated"
echo "Git submodules were updated"