Skip to content

Use file credential storage auth to support nested submodules #1

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 1 commit 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
16 changes: 9 additions & 7 deletions script/updategitsubmodules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ if [ -z "$GITHUB_TOKEN" ]; then
exit
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:\/\/$GITHUB_TOKEN@github.com/" .gitmodules
cat << credentials-file >> ~/.git-credentials
https://git:$GITHUB_TOKEN@github.com
credentials-file

cat << config-file >> ~/.gitconfig
[credential]
helper = store
config-file

if [ "$CF_SUBMODULE_SYNC" = "true" ]; then
echo "\$CF_SUBMODULE_SYNC var is set to 'true'. Syncing submodules"
Expand All @@ -27,4 +29,4 @@ 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"