Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #22 from aiming/fix-disable-retry
Browse files Browse the repository at this point in the history
リトライが正常に働かなかった現象の修正
  • Loading branch information
takesato authored Aug 18, 2023
2 parents c0dac25 + 34ebb8c commit cd29953
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,45 @@ jobs:
- name: Check .gitconfig
run: |
cat ~/.gitconfig
- name: Test do not retry if command successfull
run: |
source try.sh
before=$(date +%s)
try_till_success ls
after=$(date +%s)
# コマンド呼び出しに時間がかかっているかでリトライ判定をしています
if [ $(($after - $before)) -gt 1 ]; then
echo "::error:: 成功時にもリトライしています after = ${after}, before = ${before}"
exit 1
fi
- name: Test do retry if command failure
shell: bash +e -x {0}
run: |
source try.sh
before=$(date +%s)
try_till_success false
after=$(date +%s)
# コマンド呼び出しに時間がかかっているかでリトライ判定をしています
if [ $(expr $after - $before) -lt 2 ]; then
echo "::error:: 失敗時にリトライしていません after = ${after}, before = ${before}"
exit 1
fi
- name: Setup github.com connection
continue-on-error: true
run: |
# disable connect to github.com
echo '127.0.0.1 github.com' | sudo tee -a /etc/hosts
- name: Test retry checkout
continue-on-error: true
uses: ./
with:
depth: ''
checkout_dir: step7
2 changes: 0 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ runs:
- shell: bash
if: ${{ !env.ACT }}
run: |
set -x
echo $GITHUB_ACTION_PATH
source $GITHUB_ACTION_PATH/try.sh
Expand Down
3 changes: 3 additions & 0 deletions try.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ function try_till_success {

while [[ $attempt < $max_attempts ]]
do
oldopt=$-
set +e
"$@"
exitCode=$?
set -$oldopt

if [[ $exitCode == 0 ]]
then
Expand Down

0 comments on commit cd29953

Please sign in to comment.