-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vercel-submodule-workaround.sh
37 lines (28 loc) · 878 Bytes
/
vercel-submodule-workaround.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
set -Eeuo pipefail
GITMODULES=".gitmodules"
FEXT=".bak"
GITMODULES_BACKUP="${GITMODULES}${FEXT}"
function cleanup {
echo "Cleaning the runner..."
rm -f "$GITMODULES" "$GITMODULES_BACKUP"
git restore "$GITMODULES"
echo "Done!"
}
trap cleanup EXIT
function submodule_workaround {
if [ "$GITHUB_REPO_CLONE_TOKEN" == "" ]; then
echo "GITHUB_REPO_CLONE_TOKEN is empty!"
exit 1
fi
echo "Monkey patching..."
sed -i"$FEXT" "s/[email protected]:/https:\/\/oauth2:${GITHUB_REPO_CLONE_TOKEN}@github.com\//" "$GITMODULES"
echo "Done!"
echo "Synchronising submodules' remote URL configuration..."
git submodule sync
echo "Done!"
echo "Updating the registered submodules to match what the superproject expects..."
git submodule update --init --recursive --jobs "$(getconf _NPROCESSORS_ONLN)"
echo "Done!"
}
submodule_workaround