4040 - shell : bash
4141 if : ${{ !env.ACT }}
4242 run : |
43- set -xe
43+ set -x
44+
45+ source ./try.sh
46+
47+ try_till_success curl -s 'https://github.com' > /dev/null
4448
4549 export __SHA=${{ inputs.sha || github.sha }}
4650 if [ ! -z "${{ inputs.branch_name }}" ]; then
4953 __BRANCH=${__BRANCH#refs/heads/}
5054
5155 # Override sha value if branch_name is presented.
52- __SHA=$(/usr/bin/git ls-remote https://${{ inputs.github_actor }}:${{ inputs.github_token }}@github.com/${{ inputs.github_repository }}.git | grep -E "\srefs/heads/${__BRANCH}$" | cut -f 1 )
56+ __SHA=$(try_till_success /usr/bin/git ls-remote https://${{ inputs.github_actor }}:${{ inputs.github_token }}@github.com/${{ inputs.github_repository }}.git | grep -E "\srefs/heads/${__BRANCH}$" | cut -f 1 )
5357 fi
5458
5559 if ! ${{ inputs.fetch_lfs }}; then
@@ -61,11 +65,12 @@ runs:
6165 DEPTH=--depth=${{ inputs.depth }}
6266 fi
6367
64- /usr/bin/git clone \
65- $DEPTH \
66- --reference-if-able=${{ inputs.reference_dir }} \
67- https://${{ inputs.github_actor }}:${{ inputs.github_token }}@github.com/${{ inputs.github_repository }}.git \
68- ${{ inputs.checkout_dir }}
68+ try_till_success \
69+ /usr/bin/git clone \
70+ $DEPTH \
71+ --reference-if-able=${{ inputs.reference_dir }} \
72+ https://${{ inputs.github_actor }}:${{ inputs.github_token }}@github.com/${{ inputs.github_repository }}.git \
73+ ${{ inputs.checkout_dir }}
6974
7075 if [ $(git config --global --get-all safe.directory | grep -c "$(pwd)$") -eq 0 ]; then
7176 /usr/bin/git config --global --add safe.directory $(pwd)
7580 if [ ! -z "$__BRANCH" ]; then
7681 /usr/bin/git checkout -B $__BRANCH origin/$__BRANCH
7782 else
78- /usr/bin/git fetch $DEPTH origin $__SHA
83+ try_till_success /usr/bin/git fetch $DEPTH origin $__SHA
7984 /usr/bin/git reset --hard FETCH_HEAD
8085 fi
8186
0 commit comments