diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index adfa765..429131f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,8 +17,8 @@ jobs: with: command: true - test-fail-command: - name: test fail command + test-fail-command-1: + name: test fail command 1 runs-on: ubuntu-latest steps: - name: Checkout repository @@ -35,3 +35,22 @@ jobs: echo "This command has failed" \ && echo "Failed command concatenated" continue-on-error: true + + test-fail-command-2: + name: test fail command 2 + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: retry + uses: ./ + with: + command: false + retries: 2 + pause: 1 + fail_command: | + sudo sysctl -w net.ipv4.ip_forward=1 \ + && sudo systemctl restart docker + continue-on-error: true diff --git a/README.md b/README.md index 7033d57..9c8b9cc 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,13 @@ This action allows you to retry shell command for a few times in case they fail. The following inputs can be used to alter the Docker tag name determination: -| Input | Required | Default | Description | -|-----------|----------|----------|-------------------------------------------| -| `retries` | No | `10` | How many times to retry on failure. | -| `pause` | No | `10` | How many seconds to wait between retries. | -| `command` | Yes | `` | Shell command to execute | -| `workdir` | No | `` | Switch to this working directory prior executing the shell command | +| Input | Required | Default | Description | +|----------------|----------|----------|-------------------------------------------| +| `retries` | No | `10` | How many times to retry on failure. | +| `pause` | No | `10` | How many seconds to wait between retries. | +| `command` | Yes | `` | Shell command to execute. | +| `workdir` | No | `` | Switch to this working directory prior executing the shell command. | +| `fail_command` | No | `` | Shell command to execute on every failure of given `command`. | ## :arrow_backward: Outputs @@ -48,6 +49,9 @@ jobs: pause: 10 command: | docker build -t test . + fail_command: | + sudo sysctl -w net.ipv4.ip_forward=1 \ + && sudo systemctl restart docker \ ```