Files
actions/retry/README.md
T
2025-10-05 15:12:20 +02:00

2.0 KiB

Ultralytics logo

🔄 Step-Level Retry Action

Retries a step while preserving its full context and environment.

🚀 Usage

Basic Usage

Retry failed step up to 3 times (default):

steps:
  - uses: ultralytics/actions/retry@main
    with:
      run: python train.py

Advanced Usage

Full configuration with custom retries, timeout, and delay:

steps:
  - uses: ultralytics/actions/retry@main
    with:
      run: |
        python setup.py install
        pytest tests/
      retries: 2 # Retry twice after initial attempt (3 total runs)
      timeout_minutes: 30 # Each attempt times out after 30 minutes
      retry_delay_seconds: 60 # Wait 60 seconds between retries
      shell: bash # Use python or bash shell

Python Shell Example

steps:
  - uses: ultralytics/actions/retry@main
    with:
      shell: python
      retries: 5
      run: |
        import requests
        response = requests.get('https://api.example.com/data')
        response.raise_for_status()

📋 Inputs

Input Description Required Default
run Command to run Yes -
retries Number of retry attempts after initial No 3
timeout_minutes Maximum time in minutes for each attempt No 60
retry_delay_seconds Delay between retries in seconds No 30
shell Shell to use (bash or python) No bash

✨ Features

  • Preserves environment variables and step context
  • Configurable timeout per attempt
  • Exponential backoff with retry delay
  • GitHub Actions grouping for retry attempts
  • Supports both Bash and Python shells