This repository was archived by the owner on Feb 2, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -110,3 +110,45 @@ jobs:
110110 - name : Check .gitconfig
111111 run : |
112112 cat ~/.gitconfig
113+
114+ - name : Test do not retry if command successfull
115+ run : |
116+ source try.sh
117+
118+ before=$(date +%s)
119+ try_till_success ls
120+ after=$(date +%s)
121+
122+ # コマンド呼び出しに時間がかかっているかでリトライ判定をしています
123+ if [ $(($after - $before)) -gt 1 ]; then
124+ echo "::error:: 成功時にもリトライしています after = ${after}, before = ${before}"
125+ exit 1
126+ fi
127+
128+ - name : Test do retry if command failure
129+ shell : bash +e -x {0}
130+ run : |
131+ source try.sh
132+
133+ before=$(date +%s)
134+ try_till_success false
135+ after=$(date +%s)
136+
137+ # コマンド呼び出しに時間がかかっているかでリトライ判定をしています
138+ if [ $(expr $after - $before) -lt 2 ]; then
139+ echo "::error:: 失敗時にリトライしていません after = ${after}, before = ${before}"
140+ exit 1
141+ fi
142+
143+ - name : Setup github.com connection
144+ continue-on-error : true
145+ run : |
146+ # disable connect to github.com
147+ echo '127.0.0.1 github.com' | sudo tee -a /etc/hosts
148+
149+ - name : Test retry checkout
150+ continue-on-error : true
151+ uses : ./
152+ with :
153+ depth : ' '
154+ checkout_dir : step7
Original file line number Diff line number Diff line change 4040 - shell : bash
4141 if : ${{ !env.ACT }}
4242 run : |
43- set -x
44-
4543 echo $GITHUB_ACTION_PATH
4644 source $GITHUB_ACTION_PATH/try.sh
4745
Original file line number Diff line number Diff line change @@ -16,8 +16,11 @@ function try_till_success {
1616
1717 while [[ $attempt < $max_attempts ]]
1818 do
19+ oldopt=$-
20+ set +e
1921 " $@ "
2022 exitCode=$?
23+ set -$oldopt
2124
2225 if [[ $exitCode == 0 ]]
2326 then
You can’t perform that action at this time.
0 commit comments