File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44if [ -n " $GITHUB_TOKEN " ]; then
55 echo " Using HTTPS with GitHub token"
6+
7+ # Verify token is not empty after trimming
8+ if [ -z " ${GITHUB_TOKEN// } " ]; then
9+ echo " Error: GITHUB_TOKEN is set but empty"
10+ exit 1
11+ fi
612
713 # Overwrite the submodule URL with token-authenticated URL
814 git submodule set-url apps/web/src/content/newsletters-premium \
915 https://$GITHUB_TOKEN :@github.com/apsinghdev/opensox-newsletters-premium.git
1016
1117elif [ -n " $GIT_SSH_KEY " ]; then
1218 echo " Using SSH key authentication"
19+
20+ if [ -z " ${GIT_SSH_KEY// } " ]; then
21+ echo " Error: GIT_SSH_KEY is set but empty"
22+ exit 1
23+ fi
24+
25+ if ! echo " $GIT_SSH_KEY " | grep -qE " ^(ssh-ed25519|ssh-rsa|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521|-----BEGIN)" ; then
26+ echo " Error: GIT_SSH_KEY does not appear to be a valid SSH key"
27+ exit 1
28+ fi
29+
1330 mkdir -p ~ /.ssh
1431 printf ' %s' " $GIT_SSH_KEY " > ~ /.ssh/id_ed25519
1532 chmod 600 ~ /.ssh/id_ed25519
1633 ssh-keyscan github.com >> ~ /.ssh/known_hosts
34+
1735else
1836 echo " No authentication found!"
1937fi
2038
21- git submodule update --init --recursive --force
22- echo " Submodules initialized successfully"
39+ if git submodule update --init --recursive --force; then
40+ echo " Submodules initialized successfully"
41+ else
42+ echo " Warning: Submodule initialization failed, but continuing build..."
43+ echo " Note: Public newsletters will still work. Premium newsletters require authentication."
44+ exit 0
45+ fi
You can’t perform that action at this time.
0 commit comments