Skip to content

Commit

Permalink
feat: added repeat action
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislavulrych committed Jan 4, 2025
1 parent 74ae652 commit 82b726c
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions action.yml
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

0 comments on commit 82b726c

Please sign in to comment.