-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74ae652
commit 82b726c
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: 'Repeat Action' | ||
description: 'Repeat given command n times or until succeeds' | ||
inputs: | ||
command: | ||
description: 'Command to execute' | ||
required: true | ||
count: | ||
description: 'Count of repetitions' | ||
required: false | ||
default: 1 | ||
outputs: | ||
status: | ||
description: "Exit value of the command (error if no execution was successful)" | ||
value: ${{ steps.repeat.outputs.status }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Run action | ||
id: repeat | ||
shell: bash | ||
run: | | ||
for i in $(seq 1 ${{ inputs.count }}); | ||
do | ||
echo "$i: ${{ inputs.command }}" | ||
{ ${{ inputs.command }} ; status=$?; } || true | ||
echo "$i: status=$status" | ||
if [[ "$status" -eq 0 ]] | ||
then | ||
break | ||
fi | ||
done | ||
echo "statusr=$status" >> $GITHUB_OUTPUT |