deskflow/.github/actions/run-retry/action.yml
Nick Bolton f9287cddd1
Add run-retry action to workaround integtest gcovr issue (#7507)
* Add `run-retry` composite action to workaround `integtest` `gcovr` issue

* Update ChangeLog

* Add comment explaining retry
2024-09-12 10:20:53 +01:00

31 lines
829 B
YAML

name: "Retry command"
description: "Retries a specified command up to a specified number of times."
inputs:
run:
description: "The command to run"
required: true
retries:
description: "Number of retries"
required: false
default: 3
runs:
using: "composite"
steps:
- name: Run Command with Retry
shell: bash
run: |
command="${{ inputs.run }}"
retries=${{ inputs.retries }}
delay=${{ inputs.delay }}
attempt=1
until $command; do
if [ $attempt -ge $retries ]; then
echo "Attempt $attempt failed! No more retries left."
exit 1
fi
echo "Attempt $attempt failed! Retrying in $delay seconds..."
attempt=$((attempt + 1))
done
echo "Command succeeded on attempt $attempt."