Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/actions/retry-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Retry action
description: >
Retry a failed action up to a given number of times (by default 3 times).

inputs:
command:
description: The command or commands to run.
required: true
max-retries:
description: The number of times to retry. Default is 3.
required: false
default: '3'

runs:
using: composite
steps:
- name: Run command with retries
run: |
command() {
bash -c "${{ inputs.command }}"
}

for i in $(seq 1 ${{ inputs.max-retries }}); do
echo "Running command (attempt $i)."
if command; then
echo "Command succeeded on attempt $i."
exit 0
else
echo "Command failed on attempt $i."
fi
done
echo "Command failed after ${{ inputs.max-retries }} attempts."
exit 1
shell: bash
5 changes: 4 additions & 1 deletion .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- run: yarn --immutable
- name: Install Yarn dependencies
uses: ./.github/actions/retry-action
with:
command: yarn --immutable
- name: Cache "@metamask/snaps-execution-environments" build
id: cache-snaps-execution-environments-build
uses: actions/cache@v4
Expand Down
Loading