File tree Expand file tree Collapse file tree 1 file changed +0
-31
lines changed Expand file tree Collapse file tree 1 file changed +0
-31
lines changed Original file line number Diff line number Diff line change 4242 exit 1 # throw error
4343 fi
4444 EOF
45-
46- - name : Run Script to Push serve
47- env :
48- SSH_PRIVATE_KEY : ${{ secrets.SSH_PRIVATE_KEY }}
49- SSH_HOST : ${{ secrets.SSH_HOST }}
50- SSH_USER : ${{ secrets.SSH_USER }}
51- BLOG_PATH_REMOTE : ${{ secrets.BLOG_PATH_REMOTE }}
52- run : |
53- ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts
54- ssh $SSH_USER@$SSH_HOST << EOF
55- cd $BLOG_PATH_REMOTE
56-
57- MAX_RETRIES=8
58- RETRY_COUNT=0
59-
60- while [ \$RETRY_COUNT -lt \$MAX_RETRIES ]; do
61- if git pull origin main; then
62- break # pull succesful exit
63- else
64- echo "Git pull failed, retrying (\$((RETRY_COUNT + 1)) of \$MAX_RETRIES)..."
65- ((RETRY_COUNT++))
66- sleep 5
67- fi
68- done
69-
70- # check if retry count exceeded
71- if [ \$RETRY_COUNT -eq \$MAX_RETRIES ]; then
72- echo "Failed to pull code after \$MAX_RETRIES attempts. Exiting."
73- exit 1 # throw error
74- fi
75- EOF
You can’t perform that action at this time.
0 commit comments